The for loop iterates a (potentially huge) list returned by the backticks.
If you want to avoid creating that list, you can use open thusly:
open CMD, '-|', 'ls -l' or die $!; while( my $fname = <CMD> ) { chomp $fname; #process the file names one at a time } close CMD;
In reply to Re: A simple backticks question
by BrowserUk
in thread A simple backticks question
by return0
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |