[Memphis.pm] perl one liner
Keith W. Sheffield
sheff at pobox.com
Wed Sep 26 18:59:32 CDT 2001
>>>>> "Steve" == Steve Lane <sml at zfx.com> writes:
> this is likely to be a hair faster:
> timex perl -ne '}print$.-1 ."\n";{' hal.tmp
The -1 will result in an incorrect answer.
> it's about 1% faster on my machine.
> if you've got Deparse and want to see what's going
> on with these examples, run these commands...
> perl -MO=Deparse -lpe '}$_=$.;{' hal.tmp
> perl -MO=Deparse -ne '}print$.-1 ."\n";{' hal.tmp
> --
> Steve Lane <sml at zfx.com>
chomp is what's probably sucking up the extra time. I could have done it
like: perl -pe '}$_="$.\n";{' or a few other variations I suppose. Is the
1% worth those three extra characters? =)
----------------------------------------------------------------------------
To unsubscribe, please send email to majordomo at pm.org
with 'unsubscribe memphis-pm-list' in the body of the message.
----------------------------------------------------------------------------
More information about the Memphis-pm
mailing list