develooper Front page | perl.beginners | Postings from April 2010

Newbie stuck at the first hurdle

Thread Next
From:
Kryten
Date:
April 22, 2010 01:36
Subject:
Newbie stuck at the first hurdle
Message ID:
5b254bdf-f4fe-4ebf-ac57-f68219a0acd9@b6g2000yqi.googlegroups.com
Hi,

This is embarrassing.

All I want to do is read the content of a simple 10 line .txt file
into an array
and print out the lines, and I just can't seem to get it to work!
/*
$target = "D:\testfile.txt";
open NEWBIE, "<"$target";
@arr = <WAWA>;
foreach $line (@arr) {
print "$line\n";
}
close(NEWBIE)
*/


Running this in Primalscript does not result in anything other than
the
Exit code: 0 , 0000h message.

Is it ok to reference the full path in the 2nd arg to 'open'?

Would appreciate any help..while I wait for my copies of
Learning Perl and Programming Perl to arrive!

Thanks,
Stuart




Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About