G
gerard.l1.demers
I'm looking for a code snippet that works to place an unzipped
contents of a file into an array. I thought this should work but get
the following from the code:
$ ./testsplit2a.pl
Referenced:
Dereferenced:
original: SCALAR(0x6055d30)
Reference_example ARRAY(0x5eaac90)
Array_example toast fruit cereal
# Code snippet
# gunzip example into an array reference
gunzip $input => \@outPut
or die "gunzip failed: $GunzipError\n";
my @outPutArray = @$outPut;
foreach $outRec (@outPutArray) {
print($outRec);
}
print "Referenced: $outPut\n";
print "Dereferenced: @$outPutArray\n";
print "original: @outPut\n";
# Example of array reference that seems to work
my $array1_ref = ['toast', 'fruit', 'cereal'];
my @array = @$array1_ref;
print "Reference_example $array1_ref\n";
print "Array_example @array\n";
contents of a file into an array. I thought this should work but get
the following from the code:
$ ./testsplit2a.pl
Referenced:
Dereferenced:
original: SCALAR(0x6055d30)
Reference_example ARRAY(0x5eaac90)
Array_example toast fruit cereal
# Code snippet
# gunzip example into an array reference
gunzip $input => \@outPut
or die "gunzip failed: $GunzipError\n";
my @outPutArray = @$outPut;
foreach $outRec (@outPutArray) {
print($outRec);
}
print "Referenced: $outPut\n";
print "Dereferenced: @$outPutArray\n";
print "original: @outPut\n";
# Example of array reference that seems to work
my $array1_ref = ['toast', 'fruit', 'cereal'];
my @array = @$array1_ref;
print "Reference_example $array1_ref\n";
print "Array_example @array\n";