I'm not sure if I understand you correctly. Sure you can use variables instead of hardcoding the paths. You can also use Perl environment variables by using %ENV. Try the code below to get an overview.

use strict; use warnings; foreach my $key (keys(%ENV)) { printf("%-10.10s: $ENV{$key}\n", $key); }

Output on my system (slightly edited)

HOME : /Users/dharry LOGNAME : dharry DISPLAY : /tmp/launch-uz3Zcp/:0 COMMAND_MO: unix2003 VERSIONER_: no PATH : /usr/bin:/bin:/usr/sbin:/sbin APP_ICON_2: ../Resources/Eclipse.icns SHELL : /bin/bash JAVA_START: 1 SSH_AUTH_S: /tmp/launch-tK7iUz/Listeners Apple_PubS: /tmp/launch-SmQdNX/Render TMPDIR : /var/folders/F9/tmp/ USER : dharry VERSIONER_: 5.10.0

You can also set certain variables like LOGDIR.

Cheers

Harry

Update

Missed something the first time I read the post.

When i try to invoke the xinclude parser, it is not able to access the file even though i initialize the variable with a pre-determined path.

Does the variable contains what you think it does? Does the parser throw an error? Try adding use warnings as well. At first glance I see no reason why it shouldn't work.


In reply to Re^3: Using environment variables in xi:include by dHarry
in thread Using environment variables in xi:include by joeperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.