Too many to even scratch the surface :), but one comes to mind...
When I first started with Perl, I would get the base part of a filename with:
my $iam = `basename $0`; chomp $iam;
Which is silly, of course. Why go to the shell when you've got Perl?
For a long while I then used something I thought much more clever:
Even as I type it now, my fingers still remember it from so much usage. It worked great, but only in Linux.(my $iam = $0) =~ s,.*/,,;
I finally started learning more about the available core modules, and now I know the way to go is:
use File::Basename; my $iam = basename $0;
As an aside to your meditation, if you're in Windows, you should be able to type just "filename" (without the .pl extension). If it doesn't work, you may have to edit your "Advanced system settings" (under System in the Control Panel), and add ";.PL" to the end of the PATHEXT variable in your "System Variables" list.
In reply to Re: It's the little things...
by liverpole
in thread It's the little things...
by Lady_Aleena
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |