SPUG: regular expression difficulty, plus compiled perl

David Corcoran davec at icthus.net
Tue Mar 28 01:03:32 CST 2000


>$test1 or $0... Try this:
>$test1 =~ s#.*\\##;    # replace everything
>                       # before the last \
>                       # with nothing...
>
I think he wanted the path sans the file name:
($test1 = $0)=~ s#(.*)\\.*$#$1#;

which is a combination of the two:

>> ($test1 = $0)=~ m#.*\\#;
>> #$test1 =~ s/(.*\\)/$1/; # I tried this too, and


------------------------------------------------------------
Get your FreeMail @ Icthus.Net - http://freemail.icthus.net

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace "action" below by subscribe or unsubscribe
           Email to majordomo at pm.org: "action" spug-list your_address





More information about the spug-list mailing list