Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Regex question

by YuckFoo (Abbot)
on Aug 19, 2005 at 02:35 UTC ( #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


Comment on Re: Regex question
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2014-08-30 10:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (292 votes), past polls