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
PM
Subject
Re: pack an array
[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
Subject
Re: pack an array
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
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
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
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
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