Re: pack an array

2006-01-04 Thread Dave Gray
On 1/2/06, John W. Krahn [EMAIL PROTECTED] wrote: Gerard Robin wrote: Hello, Hello, I guess that one can write in more perlish fashion that I did: the part between the of this script to pack the array @array. Please, can someone give me some hint ? You don't need to use

Re: pack an array

2006-01-03 Thread DBSMITH
PM Subject Re: pack an array

Re: pack an array

2006-01-03 Thread JupiterHost.Net
[EMAIL PROTECTED] wrote: what is this pack actually doing compressing the data in each element or the entire array or both? Derek, I know you know about perldoc, I've seen it recommended to you dozens of times :) perldoc -f pack Takes a LIST of values and converts it into a string

Re: pack an array

2006-01-03 Thread DBSMITH
Subject Re: pack an array

pack an array

2006-01-02 Thread Gerard Robin
Hello, I guess that one can write in more perlish fashion that I did: the part between the of this script to pack the array @array. Please, can someone give me some hint ? #!/usr/bin/perl # pack_array.pl use strict; use warnings; my $string = [EMAIL PROTECTED] n??e#w [?! \$ \% y]e

Re: pack an array

2006-01-02 Thread Shawn Corey
Gerard Robin wrote: Hello, I guess that one can write in more perlish fashion that I did: the part between the of this script to pack the array @array. Please, can someone give me some hint ? #!/usr/bin/perl # pack_array.pl use strict; use warnings; my $string = [EMAIL PROTECTED] n??e

Re: pack an array

2006-01-02 Thread Tom Phoenix
On 1/2/06, Gerard Robin [EMAIL PROTECTED] wrote: my @pack; my $j = 0; foreach my $i (0..$#array) { if ($array[$i] eq '') { $i++; } else { $pack[$j] = $array[$i]; $j++; } } You're right that this doesn't seem very Perl-ish. Real Perl programmers don't use

Re: pack an array

2006-01-02 Thread John W. Krahn
Gerard Robin wrote: Hello, Hello, I guess that one can write in more perlish fashion that I did: the part between the of this script to pack the array @array. Please, can someone give me some hint ? You don't need to use an array for that: my $string = [EMAIL PROTECTED] n??e#w

Re: pack an array

2006-01-02 Thread Gerard Robin
On Mon, Jan 02, 2006 at 10:07:44AM -0800, Tom Phoenix wrote: my @pack; my $empties = 0; foreach my $item (@array) { if ($item eq '') {# empty string $empties++; } else { push @pack, $item; } } Thanks, very nice. It's difficult (for me ;-)) to think in