On Mon, Nov 9, 2009 at 10:25 AM, axr0284 <axr0...@yahoo.com> wrote:
> Hi,
>  I am completely stumped with how to proceed with this.
> I have a program where the user inputs a path to a file. This is under
> windows xp
>
> The path can be relative
> ..\..\..\synthesis\int_code.psm
> .\program\synthesis\int_code.psm
>
> or absolute
> c:\command\tool\program\synthesis\int_code.psm
>
> I do not know what it is in advance.
>
> 1)I would need perl to be able to distinguish between a relative and
> absolute path
>
> 2) If the path is relative, create an absolute path from that.
>
> My orignal idea was to locate ..\ with regex using m/([.]{2}\\)/ This
> would indicate if the path is relative or not
>
> use cd to obtain the present working directory. Is there a better way
> to do this???
>

Take a look at the core File::Spec module, particularly the rel2abs() method.

HTH,

-- jay
--------------------------------------------------
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.downloadsquad.com  http://www.engatiki.org

values of β will give rise to dom!

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to