print p( {align=>'center'}, a( {href=>'/cgi-bin/vault.pl'}, img{src=>'/data/images/hellas.gif'} ));
Here Perl can find is own way to determine and opne the file, how come it doesnt need an absolute path here?

Perl never sees those uris (not paths) as anything but strings. Those uris are sent to the web browser as is, never checked or opened.

The web browser create absolute uris from those relative uris and the uri of the document in which they are found, parses the uris into their components, requests those uris (sending only the path portion of the the absolute uri). Apache converts the partial uris to disk paths with the help of DocumentRoot and serves the files.

How would i be able to specify the correct path since the paths would differ?

Well, you could put it in a directory relative to your script, or you could place a configuration file with the location of the file in a directory relative to the script.


In reply to Re^5: Cannot open a file using a relative path by ikegami
in thread Cannot open a file using a relative path by Nik

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.