O Wise Monks, I seek your advice on the following: Can anyone explain why the following simple code works on my WinXP setup but not on the HPUX 11.00 release we have on our computer at work:
$filename="auditlog.txt"; open FILE,$filename; while (<FILE>) { print "$_"; }
Prints the file, easy enough right? That's what it does on XP. On the HPUX it simply drops back to the prompt nothing displayed. I've done variations on the filename, giving the full path even though the script and log file are in the same directory. Running perl -w only tells me that I'm using an unitialized variable on line 2 A perl -v gives me
This is perl, version 4.0 $RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $ Patch level: 36 Copyright (c) 1989, 1990, 1991, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 4.0 source +kit.
I think perhaps that there isn't a full install of Perl on the machine. Any ideas? stu

update: lol, yeah I already figured on the updating of Perl and just grabbed the update package a little while ago. When I tried testing the file open condition it would error out (not in a good way) if I used "or die", and the same results as mentioned below if I used "|| die" But even with older versions and what not, this should work, right? Very odd.
---
update #2: @davis: Huh, I ran the swlist and according to it, Perl's not even installed on the machine. The perl I'm using (I found by whereis) is in our /usr/contrib/bin

Interesting...I'll do the update (gotta clear it with the powers that be first) and see if that doesn't fix the prob.

Nothing like being a *NIX newbie.

Thanks!



update #3: alaka-zam! so it was requested, so shall it be done.

In reply to Perl 101 Problem by stu72

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.