in reply to Re: Adding Strings to an Array Permanently
in thread Adding Strings to an Array Permanently

Uh, this is a bit embarrasing, but...
I'm very new to perl. I don't think you can be much newer than me. Could you give me some little snippet of code with an example of what you're saying, Roger?

Thanks again,
OxYgEn
  • Comment on Re: Re: Adding Strings to an Array Permanently

Replies are listed 'Best First'.
Re: Re: Re: Adding Strings to an Array Permanently
by Roger (Parson) on Mar 02, 2004 at 00:55 UTC
    #!/usr/bin/perl -w use strict; use IO::File; use Data::Serializer; use Data::Dumper; my @list; my $s = Data::Serializer->new( serializer => 'Storable', portable => 0, compress => 0, ); if (-s "./list.bin") { print "Load ice and thaw\n"; my $f = new IO::File "./list.bin", "r" or die; my $ice = do { local $/; <$f> }; @list = @{$s->thaw($ice)}; print Dumper(\@list); } else { print "Build list and freeze\n"; @list = qw/ 0 1 2 3 /; my $ice = $s->freeze(\@list); my $f = new IO::File "./list.bin", "w" or die; print $f $ice; }