In article <[EMAIL PROTECTED]>, Brian Gerard wrote:
> And the clouds parted, and Kevin Pfeiffer said...
[...]
>> If I don't escape the slash in the char class -- i.e. /([^\/]+)$/ -- I
>> get this error:
>> Unmatched [ in regex; marked by <-- HERE in m/([ <-- HERE ^/ at ./test-0
>> line 7.
>>
>> T
There is a much simpler way of getting the path and the filename -
use File::Basename;
my ($rfile, $dirname) = fileparse($roriginal_file); # split up the file name
works very well.
randy
"Brian Gerard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> And the clouds parted, and Kev
And the clouds parted, and Kevin Pfeiffer said...
> >
> > Here's a line that will give you exactly that.
> > ($PROGNAME = $0) =~ s|(\.?\.?(/[^/]+)*/)?([^/]+)|$3|;
>
> I have two questions...
>
> I came up with this earlier today:
> my ($program) = $0 =~ /([^\/]+)$/;
>
> Doesn't it do the same?
In article <[EMAIL PROTECTED]>, Brian Gerard wrote:
[...]
> I ran into exactly this issue, but I wanted to just get the actual script
> name. $0 returns the entire path the script was invoked as. ie - $0
> could be "../../foo/bar/blarch/scriptname.pl", but I just wanted
> "scriptname.pl".
>
> He
> > On Thursday 30 Oct 2003 5:11 pm, Yannick Warnier wrote:
> > > Le jeu 30/10/2003 à 17:56, Gary Stainburn a écrit :
> > > > You can write $0 as well as reading it, which will change what
> > > > appears when you run ps etc.
> > > >
> > > > This can be usefull for security reasons such as hiding
> On Thursday 30 Oct 2003 5:11 pm, Yannick Warnier wrote:
> > Le jeu 30/10/2003 à 17:56, Gary Stainburn a écrit :
> > > You can write $0 as well as reading it, which will change what appears
> > > when you run ps etc.
> > >
> > > This can be usefull for security reasons such as hiding sensitive d
And the clouds parted, and [EMAIL PROTECTED] said...
> 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
> {
On Thursday 30 Oct 2003 5:11 pm, Yannick Warnier wrote:
> Le jeu 30/10/2003 à 17:56, Gary Stainburn a écrit :
> > You can write $0 as well as reading it, which will change what appears
> > when you run ps etc.
> >
> > This can be usefull for security reasons such as hiding sensitive data
> > passed
Le jeu 30/10/2003 à 17:56, Gary Stainburn a écrit :
> You can write $0 as well as reading it, which will change what appears when
> you run ps etc.
>
> This can be usefull for security reasons such as hiding sensitive data passed
> on the command line, and also for returning status information f
On Thursday 30 Oct 2003 12:06 pm, Sudarshan Raghavan wrote:
> [EMAIL PROTECTED] wrote:
> >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".
>
> $0 will contain the program name
> perldoc perlvar
You can w
> 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
> scriptici
> 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 = ; # what I have to put to this
[EMAIL PROTECTED] wrote:
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".
$0 will contain the program name
perldoc perlvar
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PR
13 matches
Mail list logo