>>>>> "K" == Kryten  <kryte...@googlemail.com> writes:

  K> All I want to do is read the content of a simple 10 line .txt file
  K> into an array and print out the lines, and I just can't seem to get
  K> it to work!

  K> /*
  K> $target = "D:\testfile.txt";
  K> open NEWBIE, "<"$target";

that won't even compile. are you sure you aren't seeing a compiler
error?

and check opens for errors:

open NEWBIE, "<$target" or die "can't open $target $!" ;

  K> @arr = <WAWA>;
  K> foreach $line (@arr) {
  K> print "$line\n";

your lines already have newlines so no need to print another.


  K> }
  K> close(NEWBIE)
  K> */

why the c style comments here? we can tell code from your email text.

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

why wouldn't it? paths are paths, relative or absolute. if the path is
good, the file can be usually found and opened (given proper permissions).

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to