> Hi,
> 
> I have a little problem. I have script "test.pl" and inside 
> this script I want to know what is "my name" (I mean this "test.pl".
> 
> test.pl script
> ---------------
> 
> my $this_scripts_name_is = who_am_I();
> 
> sub who_am_I
> {
>   my $my_name = xxxx; # what I have to put to this "xxxx" to 
> get "test.pl" scripts name
> 
>   return $my_name;
> }

The $0 variable already has it so no need for a sub or a new variable.
One thing is sometimes it reurns path info also /home/joemama/test.pl
That may or may not be a bad thign depending on what you're doing.

Test it out with this suicidal little script (or should I say scripticide)

#!/usr/bin/perl -w
use strict;
print "I am $0 hear me roar.\nGoodbye Cruel world!\n";
unlink $0 || die $!;

HTH
DMuey

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to