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

Re: Help with Regular Expressions

by Riales (Hermit)
on Apr 10, 2012 at 19:03 UTC ( #964389=note: print w/replies, xml ) Need Help??

in reply to Help with Regular Expressions

There is a great CPAN module for this sort of thing: File::Spec.

Specifically, it sounds like you want abs2rel:

use File::Spec; my $rel_path = File::Spec->abs2rel($CurrentPath, $BasePath);

Or were you trying to avoid using it for some reason or other?

Replies are listed 'Best First'.
Re^2: Help with Regular Expressions
by FFSparky (Acolyte) on Apr 10, 2012 at 19:22 UTC


    I was not aware of that module / abs2rel works just fine and I will now be using it.

    However I was hoping for a regular expression solution as I don't believe mine is the best and want to broaden my understanding use of these.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://964389]
[LanX]: ah... Denmark is planning to build a wall at the German border!
[LanX]: # Pestis Africana Suum
[erix]: that's an old plan, I think. Isn't there already a danewal (or some such name)?
[marto]: Build with -Wall
[erix]: Danewerk
[LanX]: I seem to remember that the danewall was build by the Frankish empire against the Danes

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2018-03-22 18:38 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (283 votes). Check out past polls.