Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: Adding Strings to an Array Permanently

by OxYgEn (Acolyte)
on Mar 02, 2004 at 00:33 UTC ( #333120=note: print w/ replies, xml ) Need Help??


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; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://333120]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2016-08-28 14:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (393 votes). Check out past polls.