in reply to Looking for some insight on Tie::File
Line my @rows = @$ref; copies the entire file into memory, therefore changing this array, doesn't affect the file. The solution is to create an alias or to use the reference instead.
For example:
Or, simpler, push directly into @$ref:my $ref = [1,2,3]; local our @row; *row = $ref; push @row, 4; print @$ref; # prints: 1234
my $ref = [1,2,3]; push @$ref, 4; print @$ref; # prints: 1234
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Looking for some insight on Tie::File
by stevieb (Canon) on Jan 09, 2016 at 00:42 UTC | |
by Anonymous Monk on Jan 09, 2016 at 00:49 UTC | |
by Anonymous Monk on Jan 09, 2016 at 00:51 UTC | |
by stevieb (Canon) on Jan 09, 2016 at 00:55 UTC | |
by Anonymous Monk on Jan 09, 2016 at 01:27 UTC | |
by stevieb (Canon) on Jan 09, 2016 at 01:42 UTC | |
|