To many managers, getting rid of the arrogant, undisciplined, over-paid, technology-obsessed, improperly-dressed programmers would appear to be a significant added benefit.
I am being sponsored by Syntress! They bought me an amazing dedicated server to run catonmat on. If you're looking web services, I highly recommend the Syntress guys!
A trick that is very useful in one-liners is using the closing-opening braces and avoid END blocks. For example, this:
perl -lne '$a++ if /regex/; END {print $a+0}'
can be turned into this:
perl -lne '$a++ if /regex/}{print $a+0'
And there's more! You can actually turn the "n" into a "p" and save a few more keystrokes using $_:
perl -lpe '$a++ if /regex/}{$_=$a+0'
This takes advantage of the code that is automagically put around your code (more or less...):
while () {
your-code-here
;print; # if -p, otherwise no print
}
which becomes:
while () {
$a++ if /regex/}{$_=$a+0
;print;
}
i.e.
while () {
$a++ if /regex/
}
{
$_=$a+0;
print;
}
I seem to remember that Abigail is to be credited for this.
Comment Responses
crazy! guys...
Reply To This Comment