I'm having trouble opening a text file in the script below. It works fine on AIX Unix but I can't seem to get the syntax right to open a file on IIS. It just says "can't open file". The script and txt files are both in the cgi-bin directory relative to the root web. Do I have to put the entire path in back to C:\ or can it be relative to the root web?
#!d:\perl use CGI qw(:standard); $ip= param("IPNum"); print "Content-type:text/html\n\n"; print <<WEB_PAGE; <html> <title>DLS Peers</title> <body> <h1>DLS Peer Information</h1> <table border=1 width=40%> <tr><th>Peers</th></tr> </table> WEB_PAGE # IP number is now passed to this script via the dslentry.htm form #print ("DLS Peer Table"); #print ("Enter Circuitless IP #\t"); #$ip=<STDIN>; #chop ($ip); print "<h3>IP number is $ip</h3>"; # Split the IP # and get the third octet @octet=split(/\./,$ip); # print ("The third octet = $octet[2]"); $trd = $octet[2]; print "<h3>The 3rd Octet is $trd</h3>"; # Build csv Array # Open the dls txt file and search for the 3rd octet $dir = "/cgi-bin/dls.txt"; open(PEERS, $dir) or print "Can't open File"; @peers = <PEERS>; print "<h3>Peers Below</h3>"; print @peers; @csv = (grep /^$trd/, @peers) or die "No such IP"; @ncsv = split(/,/, $csv[0]);

jdporter - added code tags


In reply to Opening files on IIS by ucanflyit

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.