Perl programming on MPE/iX - February 2001

February 9, 2001
Solution Symposium
Page 17
hp e3000
perl
programming
a file i/o example
#!/PERL/PUB/perl
open(HPSW, "/SYS/PUB/HPSWINFO"); # open for input
$one = <HPSW>; # read first line
$two = <HPSW>; # read second line
$three = <HPSW>; # read third line
@therest = <HPSW>; # read all remaining lines
close(HPSW); # close the file
open(PATCHES, "> /tmp/MPE.patches"); # open for output
foreach $line (@therest) { # access each array line
print PATCHES $line if $line =~ /^MPE/; # print if match
}
close(PATCHES); # close the file