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'; $fullname[1] = '/usr/bin/perl/test.pl'; #The parentheses are required around the two variables. ($filename[0] = $fullname[0]) =~ s!^.*/!!; ($filename[1] = $fullname[1]) =~ s!^.*/!!; ($filename[2] = $0) =~ s!^.*/!!; ($filename[3] = $PROGRAM_NAME) =~ s!^.*/!!; print "failed $fullname[0] -> $filename[0]\n"; print "passed $fullname[1] -> $filename[1]\n"; print "\$0 is $0\n"; print "$0 changes to $filename[2]\n"; print "\$PROGRAM_NAME is $PROGRAM_NAME\n"; print "$PROGRAM_NAME changes to $filename[3]\n"; On Sat, 03 Aug 2002 04:07:49 -0700, [EMAIL PROTECTED] (John W. Krahn) wrote: >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]