Heterogenous array

2006-01-02 Thread Aditi Gupta
Hello Everybody, A very happy new year to all of you. Well, I'm trying to create a 2D array in which the 1st array is completely numeric and the other array is a combination of numbers and text. If I write it as : @aoa = ([0..5], [1,2,undef, 3,4]); then the program accepts this array of array,

RE: Heterogenous array

2006-01-02 Thread Charles K. Clarkson
Aditi Gupta mailto:[EMAIL PROTECTED] wrote: : @aoa = ([0..5], [EMAIL PROTECTED]); : where @values = (1, 2, undef, 3, 4); : then the program does not accept it. That works just fine for me. What do you mean by the program does not accept it? #!/usr/bin/perl use strict; use warnings; use

about eval and stdin

2006-01-02 Thread Adriano Allora
hi to all, a friend of mine ask me for a perl script to change regexp patterns in some texts (he can learn regexp, but I suppose he won't learn perl). So I start write this one to him. I have a problem: == with pattern = (dir)ectory and replacement = $1, why the script does not eval $1 as

Re: Heterogenous array

2006-01-02 Thread Aditi Gupta
Hello, The error message argument 1,2,undef,3,4 isn't numeric was being displayed. But with Data Dumper it is working. Thanks:-) On 1/2/06, Charles K. Clarkson [EMAIL PROTECTED] wrote: Aditi Gupta mailto:[EMAIL PROTECTED] wrote: : @aoa = ([0..5], [EMAIL PROTECTED]); : where @values = (1,

Re: Heterogenous array

2006-01-02 Thread Xavier Noria
On Jan 2, 2006, at 12:53, Aditi Gupta wrote: The error message argument 1,2,undef,3,4 isn't numeric was being displayed. But with Data Dumper it is working. That message is a warning, your code was probably doing some math with something that didn't look like a number. From your message

Re: about eval and stdin

2006-01-02 Thread John Doe
Adriano Allora am Montag, 2. Januar 2006 12.48: hi to all, a friend of mine ask me for a perl script to change regexp patterns in some texts (he can learn regexp, but I suppose he won't learn perl). So I start write this one to him. I have a problem: == with pattern = (dir)ectory and

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 [?! \$ \%

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]

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 [?!

Where is the source code?

2006-01-02 Thread Siegfried Heintze
I'm trying to understand the algorithm for generating uuids or guids. I was hoping to use my perl debugger to single step thru the algorithm that creates guids/uuids. So I downloaded the tar.gz files at http://search.cpan.org/src/AGOLOMSH/Data-UUID-0.11/UUID.pm

RE: Where is the source code?

2006-01-02 Thread Siegfried Heintze
Sorry, I lied. I guess there is source code for Data::UUID but I cannot get it to work on windows. I tried ppm install Data::UUID and it could not find it. I tried downloading and following the instructions in the README me but that produced a lot of syntax errors. Can someone suggest how I

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