Re: [PBML] RE: Program name from $0 on Unix
- How about this:
$progname = $0;
$progname =~ s#.*/##g;
--- "Madani, Srikanth, VF-DE"
> Hi all,__________________________________________________
> Probably the most trivial of things - I want to
> extract the name of the Perl program file from the
> contents of the $0 variable, given that the program
> is being executed on a Unix machine.
> The following snippet worked:
> my @ProgramName = split /\//, $0;
> $0 = $ProgramName[$#ProgramName];
> Is there a more stylish way of doing this or is
> there a widely accepted code snippet (given that it
> is such a basic task)?
> Srikanth Madani
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around