in reply to About Special Underscore Filehandle
In question 1, the thing that's left around is the results of doing a stat of the file. An implicit stat is done when you use "-s" on a file, but a stat gives you a number of other pieces of information, which you already have in-memory.
For question 2, yes, your understanding is correct.
For question 3, you are misusing "_" as you speculated. You can't print it out, you can only use it in conjunction with one of the -x tests. However, you could do the following to print the file when it matches the tests -s and -A:
#!/perl/bin/perl use strict; my @original_files = qw/ fred /; my @big_old_files; foreach (@original_files) { if ((-s) > 0 and -A _ > 0) { push @big_old_files, $_; print "$_\n"; # Display the file name if it passes -s and -A +tests. } }
Note, too, that when you say "(-s)", you're implicitly saying "(-s $_)".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: About Special Underscore Filehandle
by merlyn (Sage) on May 04, 2007 at 17:52 UTC |