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

Re: change the end of a path inside file

by ichimunki (Priest)
on Jul 17, 2002 at 19:10 UTC ( #182556=note: print w/ replies, xml ) Need Help??


in reply to change the end of a path inside file

sub dec {return(shift)-1}; $path =~ s/(\d+)$/dec($1)/e;
will change path the way you want, be sure to copy the value before doing this so your system call has access to both values. You may also want to check for success, in case filenames do not end in digits.

thanks to ferrency for the /e tip.


Comment on Re: change the end of a path inside file
Download Code
Re: Re: change the end of a path inside file
by DS (Acolyte) on Jul 17, 2002 at 19:29 UTC
    thank you all ,, ;) nice one

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2015-07-04 03:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls