in reply to It's the little things...
What was your moment where a little thing just popped up and bit you on the toe?
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
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.
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: It's the little things...
by JavaFan (Canon) on Mar 02, 2010 at 23:50 UTC | |
by liverpole (Monsignor) on Mar 03, 2010 at 00:28 UTC | |
Re^2: It's the little things...
by ambrus (Abbot) on Mar 03, 2010 at 12:44 UTC | |
Re^2: It's the little things...
by Lady_Aleena (Priest) on Mar 03, 2010 at 00:52 UTC |
In Section
Meditations