Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: R.Exp. Matching from the Right

by mk. (Friar)
on Feb 24, 2006 at 17:14 UTC ( #532602=note: print w/replies, xml ) Need Help??


in reply to R.Exp. Matching from the Right

i assume you want the file name, without the path - is it right?! if so, try this:
(my $file = "c:/progra~1/apache~1/apache2/cgi-bin/test/new/Feb23-2006_ +0_test_error.txt")=~ s/.*\///g; print $file;

if you want to print the path as well, just use print $&;

update
the code above will replace the path with nothing, so the result will be just the filename. you might recover the path later, as i said, using $&.
still, if you really only want to match, i guess Praveen's reply will be more suitable.
=)


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (1)
As of 2022-01-20 00:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (56 votes). Check out past polls.

    Notices?