Well, the first method reads a file line by line, while your second method reads one line of the file and stops. Now if you set $/ to undef then your second method would slurp in the entire file. If you're dealing with a small file that will never become large, in an environment where your process will not be running more than a single instance, the second method would be functionally ok. But it will not scale well as file size or number if instances grows.
Dave
In reply to Re: Advantage of while(<>){while()}?
by davido
in thread Advantage of while(<>){while()}?
by Argel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |