I’m looking for a good way to save pictures from website. I’m given the urls of picture. What is the standard way to save pictures in Perl? Considering saving them as string in array or .jpg file. (which one is better?) And also, I need the functionality to modify the file name. Thanks for all your helps.
Share
Well, I guess the standard way is the following: first, you grab the content of the remote picture, then save this content under the whatever name (and path) you like.
This can be done by several ways, the easiest, I suppose, is just use plain and simple CPAN module LWP::Simple:
Well, that’s it. ) Yep, that simple. Of course, it may probably be decorated with some error checks (and related messages), but for the simplest tasks that should be quite enough.
Or even better, it can be reduced to a one-liner: