Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Anything comparable to argv0 from C in Perl?

by DrManhattan (Chaplain)
on Mar 13, 2003 at 21:38 UTC ( [id://242842]=note: print w/replies, xml ) Need Help??


in reply to Re: Anything comparable to argv0 from C in Perl?
in thread Anything comparable to argv0 from C in Perl?

Here's a one-liner to extract the base name from the full path without a temporary array:
my ($basename) = $0 =~ m/.*\/(.*)/;
You can also use split() like this:
my $basename = (split /\//, $0)[-1];

-Matt

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://242842]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-03-28 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found