Hi, this script does exactly what i want it to which is select the 14th and 15th column from a table and print it. but when it runs the horrible error message is " error! use of uninitialised value in concatenation (.) or string near FILEHANDLE>. i can't spot the error, but i think it might be around the print statements! can anyone help?? heres the code.
#! /usr/local/bin/perl -w use strict; open (FILEHANDLE, $ARGV[0]) or die "unable to open file"; open (OUTFILE, ">$$.output"); my $line; my @array; while (<FILEHANDLE>) { $line = $_; chomp ($line); @array = (); @array = split (/\s+/, $line); print STDOUT "$array[13]\t$array[14]\n"; print OUTFILE "$array[13]\t$array[14]\n"; } close FILEHANDLE; close OUTFILE; exit;
thanks :-)

Edit kudra, 2002-05-07 Changed title


In reply to Getting rid of uninitialized value warning (was: can't spot the error) by Anonymous Monk

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.