En réponse à Simon Cozens <fwp@simon-cozens.org>: > but I guess this would be a pretty useful idiom: > > perl -aln0 -F"\n" -e ... > > (Stick an entire file into @F, a line per element.) > > However, if you write it as a program, instead of > > #!/usr/bin/perl -aln0 -F"\n" > ... > > you can say > #!/usr/bin/perl -aln0 -F > ... > > because the character after -F happens to be a newline. Handy, that, eh? I have been trying this all morning, but it doesn't seem to work on the Windows 95 box I use at work (I didn't have a choice)... #!/usr/bin/perl -aln0 -F"\n" print join "<-\n->", @F; spits out (whatever delimiter I might try, ", ' or /): syntax error at wc.pl line 2, near "print" Execution of wc.pl aborted due to compilation errors. With -MO=Deparse, I don't get much: LINE: while (defined($_ = <ARGV>)) { chomp $_; } -MO=Deparsing this (with a space added) #!/usr/bin/perl -aln0 -F "\n" print join "<-\n->", @F; gives: LINE: while (defined($_ = <ARGV>)) { chomp $_; @F = split(/ "\n"\r\n/, $_, 0); # not what I wanted... print join("<-\n->", @F); } wc.pl syntax OK So I tried your no-arg trick: #!/usr/bin/perl -aln0 -F print join "<-\n->", @F; and got: LINE: while (defined($_ = <ARGV>)) { chomp $_; @F = split(/\r\n/, $_, 0); # not quite what we want print join("<-\n->", @F); } But when I try this, it only works with files that I explicitely wrote with $\ = "\r\n"... Otherwise it gives a @F array holding the whole file as its only element. Is this just me or my version of Perl? This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2001, Larry Wall Binary build 628 provided by ActiveState Tool Corp. http://www.ActiveState.com Built 15:41:05 Jul 4 2001 Anyway, I'll try those under Unix, and send my (not so good) entries to Santa tonight. -- Philippe BRUHAT - BooK When you run from your problem, you make it that much harder for good fortune to catch you, as well. (Moral from Groo The Wanderer #14 (Epic))Thread Previous | Thread Next