in reply to Re: Printing an array
in thread Printing an array
#!/usr/bin/perl -w use strict; my(@DATAFILE); @DATAFILE=&readdata(); &testcode1(@DATAFILE); &writedata(@DATAFILE); # # Subroutine for reading prev.txt into an array # sub readdata { open (PH, "prev.txt") || die "Cannot open prev.txt: $!"; my(@DATA)=<PH>; chomp @DATA; close (PH); return(@DATA); } # # Subroutine for writing array into prev.txt # sub writedata { my(@DATA)=@_; open (PH, ">prev.txt") || die "Cannot open prev.txt: $!"; foreach(@DATA) { print PH "$_\n"; } close (PH); } # # Subroutines for various tests on the code # sub testcode1 { print "@_"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Printing an array
by CountZero (Bishop) on Nov 26, 2003 at 20:33 UTC |