Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: using split on a string

by damian1301 (Curate)
on May 14, 2001 at 07:25 UTC ( #80135=note: print w/replies, xml ) Need Help??

in reply to using split on a string

You are splitting on a whitespace so it only splits it once (because you only have two variables to throw it in) and throws the rest out. What you want is:
my $pubupload = q"C:\Documents and Settings\Administrator\Desktop\chin +a.txt"; $pubupload =~ /(?:.*)\\(.*?\..*)$/; print $1;

When ran, the code gives this output:
And of course to fine the extension, you can split it up from there.

($junk, $extension)=split/\./,$1;/;
NOTE: I couldn't get split/\./,$pubupload; to work on the whole string, any ideas why?

Tiptoeing up to a Perl hacker.
Dave AKA damian

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://80135]
[mark4]: thanks. I installed "PAR-packager" and pp is working. BTW, it is pp.bat that was needed.
[mark4]: Sorry, There was a typo in my last message. I installed "PAR-Packer" and I now have a pp.bat and all is working well. Thanks again for your help.

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2018-01-19 21:33 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (223 votes). Check out past polls.