snafu has asked for the wisdom of the Perl Monks concerning the following question:
Given a known filename and due to the way we are going to run the finished product, we want to take that filename from stdin and work it a lil. So, we did the following:
For now, "saveme" is our test file (and its a blank touched file).
ls saveme | perl -n -e ' while ( <> ) { chomp; tr/\/*@//d; # remove shell aliased junk from ls open(F,$_); print eval{(lstat(F))[9]},"\n"; close(F); }'
Mind you that this snippet is only one thing we tried. Also note that we realize that there are a plethora of other ways to do this so that it works. However, it is this one phenomena that we are curious about.
Some of the other things we tried were:
$ls saveme | perl -n -e ' print "file is: ". <>,"\n"; ' file is: $ls saveme | perl -n -e ' my @files = <>;print "file: @files\n"; ' file:
What am I (are we) missing here? It has to be some fundamental rule I am forgetting/disregarding.
TIA
_
_
_
_
_
_
_
_
_
_
- Jim
Insert clever comment here...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Oddity...losing filename from stdin - very wierd
by Dog and Pony (Priest) on Apr 09, 2002 at 16:51 UTC | |
by snafu (Chaplain) on Apr 09, 2002 at 17:01 UTC | |
by hossman (Prior) on Apr 09, 2002 at 23:22 UTC | |
|
Re: Oddity...losing filename from stdin - very wierd
by Rich36 (Chaplain) on Apr 09, 2002 at 16:48 UTC | |
by snafu (Chaplain) on Apr 09, 2002 at 16:56 UTC | |
|
Re: Oddity...losing filename from stdin - very wierd
by thelenm (Vicar) on Apr 09, 2002 at 16:45 UTC | |
by snafu (Chaplain) on Apr 09, 2002 at 16:51 UTC |