You need to monitor some webpages every day. Once these webpages are updated, you can do the relevant work.
Of course, you cannot manually view every webpage every day! So I wrote a Perl script for automatic check. Run the task every day to check whether there are any updates. If there are any updates, the system automatically copies the content and saves it to a specific file in the corresponding format.
But sometimes, I need to copy this content directly to other places, such as emails. I also used the Perl script to implement this function: After the automatic check is completed, it is automatically copied to the clipboard of windows.
I think there are three points worth summarizing:
1) Use Win32: clipboard to interact with the Windows clipboard
Using this template, you can directly copy the content to the clipboard in the command line.
Use Win32: clipboard; $ clip = Win32: clipboard ();
Print "Clipboard contains:", $ clip-> get (), "\ n ";
$ Clip-> set ("some text to copy into the Clipboard ");
$ Clip-> Empty ();
$ Clip-> waitforchange ();
Print "Clipboard has changed! \ N ";
However, it cannot be installed in cygwin. It can only be used in strawberry Perl ~~
2) Let cmd or msys output Chinese Characters
In Windows, whether it is cmd or msys, if a Chinese character is printed directly in it, it will almost be garbled; in cmd or msys, Win32: clipboard is used to copy things to the clipboard, also garbled.
The following method must be used to improve the encoding:
Use encode;
$ Infor = encode ("GBK", decode ("UTF-8", $ _));
Print $ infor;
3) respond to user-defined operations
When the content is copied to the clipboard, a prompt is output to let the user know that the copy is complete, and wait for the user to enter any key to confirm, and then continue. This function is simple and can be easily implemented using this statement:
<Stdin>
This inconspicuous little tool saves me a lot of tedious work (such as opening files, judging and copying content!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.