#!/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 "@_"; }
In reply to Re: Re: Printing an array
by shemyaza
in thread Printing an array
by shemyaza
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |