Today around 12:08am, Uri Guttman hammered out this masterpiece:
: i just found an interseting little oddity i want fixed. i (like many of
: you) run one liners for testing snippets of code. i typically use a -p
: or -n loop and type in test data. i get tired of retyping in all the
: data each time when i want to edit the previous line only a little
: bit. i tried using ssfe (split screen front end, comes with sirc char
: client) and i saw no output due to pipe buffering. so i had to put a
: $|++ in the one liner to make it work. perl6 should have a command line
: option to enable $| for STDOUT.
cat /etc/passwd | perl -nfe 'print((split/:/)[0])'
-f is just like $|=1 or, for example, $fh->autoflush(1);
This, by the way (even as a test) was agravating to me because in order to
get decent output I really had to do this:
cat /etc/passwd | perl -nfe '$\="\n";print((split/:/)[0])'
or
cat /etc/passwd | perl -nfe 'print((split/:/)[0]."\n")'
So perhaps we should allow all the 'special' variables, namely the
scalars, to be assigned to on the command line via thier English
representations. Observe:
perl -OUTPUT_AUTOFLUSH=1 -OUTPUT_RECORD_SEPARATOR="\n" -ne 'print((split/:/)[0])'
Or something to that effect. However, I suppose the same could be done
with thier punctuation defaults:
cat /etc/passwd | perl '-$|=1' '-$\="\n"' -ne 'print((split/:/)[0])'
This might be nice if you can set your environment vars to have a few
defaults such as autoflush(1).
--
print(join(' ', qw(Casey R. Tweten)));my $sig={mail=>'[EMAIL PROTECTED]',site=>
'http://home.kiski.net/~crt'};print "\n",'.'x(length($sig->{site})+6),"\n";
print map{$_.': '.$sig->{$_}."\n"}sort{$sig->{$a}cmp$sig->{$b}}keys%{$sig};
my $VERSION = '0.01'; #'patched' by Jerrad Pierce <belg4mit at MIT dot EDU>