in reply to codeperl -pe 's/\n/" " . /e' data/code
perl -pe 's/\n/" " . <>/e' data
This is a command line, obviously, and if you read perlrun, you will read that -p will make the assumption that there is a while() loop around your code. So, this would look similar to the following, to Perl:
while (<>) { s/\n/" " . <>/e; }
As stated in other responses the /e allows you to be able to evaluate things on the right side of an s///.
2: if data is a filehande and this is a one-liner, how does data get input from a file with "\n"=separated values?
It isn't a filehandle, it is a file name. It get's the the data with \n seperated values because that is what the lines of the file are seperated with. This is not different that opening a file and itterating over it from within a script.
Cheers,
KM
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: codeperl -pe 's/\n/
by merlyn (Sage) on May 27, 2000 at 00:13 UTC | |
by KM (Priest) on May 27, 2000 at 00:15 UTC |