Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: using split on a string

by jorg (Friar)
on May 14, 2001 at 16:33 UTC ( [id://80189]=note: print w/replies, xml ) Need Help??


in reply to using split on a string

You could forget all this regex stuff and use a standard Perl module instead :
use File::Basename; use Data::Dumper; my $path='C:\Documents and Settings\Administrator\Desktop\china.txt'; my @fileinfo=fileparse($path, '\..*'); print Dumper(@fileinfo);
will give you
$VAR1 = 'china';
$VAR2 = 'C:\\Documents and Settings\\Administrator\\Desktop\\';
$VAR3 = '.txt';
The fileparse() function takes a path as first argument and a pattern describing the extension as second arg

Jorg

"Do or do not, there is no try" -- Yoda

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://80189]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-25 20:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found