SPUG: regular expression difficulty, plus compiled perl

Ryan Erwin ryan at dbedge.com
Mon Mar 27 23:55:54 CST 2000

I'm not sure what you are doing with the line
'($test1 = $0)=~ m#.*\\#'.  It looks like you will
just be proving that, yes m#.*\\# does in fact
match $test1, but haven't affected the value of
$test1 or $0... Try this:
$test1 =~ s#.*\\##;    # replace everything
                       # before the last \
                       # with nothing...

in your second line, it looks like you are
stuffing something like 'd:\perl\' into $1, then
replacing d:\perl\ with $1, which is basically
doing nothing...

To compile perl code on win32, you need to
download the 'Activestate Perl Development Kit'
from here:

The PDK includes a program called PerlApp that
will allow you to create both 'free standing' perl
executables, as well as executables that depend on
perl being installed.  You must be running PerlApp
on Windows NT (or maybe win2k) but not Win 9X to
build perl executables.  As a side note, i have
not been able to create 'gui' perl executables
even with the -gui switch for PDK used on a
Win32::GUI script.  Running 'editbin' on a program
solved the problem...

if anything i have stated here is wrong, i
apologize and once again declare excessive sleep
deprivation 8-}

good luck-

Ryan Erwin
ESPUG Emperor...

I wonder when i will get tired of calling myself

----- Original Message -----
From: Todd Wells <toddw at wrq.com>
To: <spug-list at pm.org>
Sent: Monday, March 27, 2000 8:20 PM
Subject: SPUG: regular expression difficulty, plus
compiled perl

> I'm using ActiveState Perl on NT4 and trying to
set a variable to be equal
> to the directory name that the script was ran
> So, I look at $0 which contains the name of the
script I ran... in this case
> But when I try to strip the filename off the
end, I can't seem to do it.
$test1 =~ s#.*\\##;
> print "First: $0\n";
> ($test1 = $0)=~ m#.*\\#;
> #$test1 =~ s/(.*\\)/$1/; # I tried this too, and
it didn't work
> either.
> print "Second: $test1\n";
> The output:
> First: D:\PERL\COUNTP~1.PL
> Second: D:\PERL\COUNTP~1.PL
> What's going on here?  Is the .* just being
_really_ greedy?  I'm expecting
> $test1 to be "D:\PERL\"
> I know this is silly, but I can't figure out the
problem here.
> BTW, someone at the last SPUG meeting mentioned
they were playing around
> with compiled Perl using ActiveState.  I can't
seem to find any specifics on
> how to do this.  Perlfaq3 mentions it, but gives
no specifics on how to
> actually do it, nor can I find any at Malcolm
Beattie's site.
> - Todd

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     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