[Edinburgh-pm] A little help with references

asmith9983 at gmail.com asmith9983 at gmail.com
Fri May 25 05:14:10 PDT 2007

Hi folks

I'm still continuing my Perl revision and verifying I understand  how it works 
with working examples.
I'm  having trouble  with  the one-liners below,
They should print the file name followed immediately by the file size between 
":" :-

This doesn't work :-

perl -e ' @files=<*>;foreach (@files){$fs=\(stat $_);;print "$_:${fs[7]}:\n";}'
but this does:-

perl -e ' @files=<*>;foreach (@files){@fstat=stat $_;$fs=\@fstat;print 

The code is essentially the same on both lines.
In the first example I  was trying to replace  the @fstat variable of the 
second,with a 
reference to an anonymous 
list but with no intermediate variables apart from the reference.
I'm obviously missing something vital, so any hints would be appreciated.

More information about the Edinburgh-pm mailing list