Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Regex question

by YuckFoo (Abbot)
on Aug 19, 2005 at 02:35 UTC ( [id://485005]=note: print w/replies, xml ) Need Help??


in reply to Regex question

cajun,

Seems like a natural for split. You get the bonus filename too.

SplitFoo

#!/usr/bin/perl use strict; while (my $line = <DATA>) { chomp $line; my ($dir, $file) = (split(m{/}, $line))[-2, -1]; print "$dir $file\n"; } __DATA__ http://www.domain.com/data/2005/sales/01012005.txt http://www.domain.com/data/2005/sales-jan/01232005.txt http://www.domain.com/data/2005/sales-local/01012005.txt http://www.domain.com/data/2005/sales-outside-jan/01012005.txt

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-23 09:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found