Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Changing data output

by Willard B. Trophy (Hermit)
on Jun 19, 2003 at 15:53 UTC ( [id://267252]=note: print w/replies, xml ) Need Help??


in reply to Changing data output

... or you could split the strings into an array on the directory separators, and join them back together, using only the third and fourth entries:
#!/usr/bin/perl -wl while (<DATA>) { chomp; print join ( '/', ( split ( '/', $_ ) )[ 3, 4 ] ); } exit; __DATA__ /mydirectory/directory/test/z2.htm /mydirectory/directory/other/testhere.htm /mydirectory/directory/test/dir/z6.htm

Of course, I'm sure there's a nicer way of being able to specify "from the third entry onwards", but I was never very good with arrays.

--
bowling trophy thieves, die!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-25 14:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found