On Friday, August 2, 2002, at 05:32 , Chip Place wrote:
> Another interesting bit of information:
>
> If I invoke the script like this
>
> $ perl myperlscript
>
> I don't get the leading ./ or path
>
> does this make any sense?
yes.
it is the same as invoking a shell script with
sh so
d. You can use it to
> get just the filename.
>
> -Original Message-
> From: Chip Place [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 02, 2002 4:29 PM
> To: [EMAIL PROTECTED]
> Subject: $0 and path
>
>
> When I try to use the value from $0, I get t
Thanks for the tip on the required parentheses around the two
variables. I will have to more careful.
my debugger handles $0 and $PROGRAM_NAME differently. Not nice.
use strict;
use warnings;
use English;
my @fullname;
my @filename;
$fullname[0] = 'C:\\Windows\\perl\\scripts\\test.pl';
$fullna
Chris wrote:
>
> On Fri, 02 Aug 2002 17:44:05 -0700, [EMAIL PROTECTED] (John W. Krahn)
> wrote:
> >
> >( my $prog = $0 ) =~ s!^.*/!!;
> >
> >print "# GENERATED BY $prog\n";
>
> Looks like my debugger is not setting up $0
>
> use strict;
> use warnings;
> my $prog = '???';
>
> $prog = $0 =~ s!^
Looks like my debugger is not setting up $0
use strict;
use warnings;
my $prog = '???';
$prog = $0 =~ s!^.*/!! if defined $0;
print "# GENERATED BY $prog\n";
On Fri, 02 Aug 2002 17:44:05 -0700, [EMAIL PROTECTED] (John W. Krahn)
wrote:
>( my $prog = $0 ) =~ s!^.*/!!;
>
>print "# GENERATED BY
Chip Place wrote:
>
> When I try to use the value from $0, I get the full path
> to the script or a leading ./ depending on how the script
> is invoked. If I want my log file to have a line similar
> to:
>
> # GENERATED BY myperlscript
>
> how can I do this without the extra info:
>
> # GENER
Check out the File::Basename module that comes standard. You can use it to
get just the filename.
-Original Message-
From: Chip Place [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 02, 2002 4:29 PM
To: [EMAIL PROTECTED]
Subject: $0 and path
When I try to use the value from $0, I get
When I try to use the value from $0, I get the full path to the script or a leading ./
depending on how the script is invoked. If I want my log file to have a line similar
to:
# GENERATED BY myperlscript
how can I do this without the extra info:
# GENERATED BY ./myperlscript
or
# GENERATED B