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!^.*/!! if defined $0; > > print "# GENERATED BY $prog\n";
The parentheses are required around the two variables. ( my $prog = $0 ) =~ s!^.*/!!; Is the same as: my $prog = $0; $prog =~ s!^.*/!!; $prog = $0 =~ s!^.*/!!; Is the same as: if ( $0 =~ s!^.*/!! ) { $prog = 1; } else { $prog = 0; } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]