[cam.pm] Compensatory typos
Roy Chaudhuri
rrc22 at cam.ac.uk
Mon Jun 4 15:39:07 BST 2007
Hi all,
Sorry to abuse the mailing list by talking about Perl, but I made a
vaguely entertaining discovery the other day. I was writing a one-liner
to print out lines from a tab-delimited file which had a last field of
less than 0. Obviously I wanted to write something like:
perl -ne '@a=split /\t/, $_; print if $a[-1]<0' myfile
but because it was a Friday and my brain was firmly in neutral I managed
to type this instead:
perl -ne '$a=split /\t/, $_; print if $_[-1]<0' myfile
Weird thing was, one typo cancelled out the other and it still worked.
Took me a fair amount of trawling through perldoc to work out why.
Anyway, ignore me, back to talking about pubs. Osborne Arms sounds good
to me.
Roy.
More information about the Cam.pm
mailing list