Re: Appending array from HoA elements into one single array

2004-08-25 Thread John W. Krahn
[please do not top-post. TIA] balaji venkat wrote: #! /usr/bin/perl You should enable warnings and strictures. use warnings; use strict; %hash1 = ( A => ["fred", "barney"], B => ["George", "jane", "elroy"] ); foreach $sub (sort (keys(%hash1))) { pr

Re: Appending array from HoA elements into one single array

2004-08-25 Thread balaji venkat
Hi Edward, Source Code : #! /usr/bin/perl %hash1 = ( A => ["fred", "barney"], B => ["George", "jane", "elroy"] ); foreach $sub (sort (keys(%hash1))) { print "$sub\n"; $temp = @hash1{$sub}; for ($i=0;$i<=$#$temp;$i++) {

Re: Appending array from HoA elements into one single array

2004-08-24 Thread John W. Krahn
Jenda Krynicky wrote: From: "John W. Krahn" <[EMAIL PROTECTED]> Edward WIJAYA wrote: Is there any efficient way to append each of this HoA's array into one single array, e.g: @name = ("fred", "barney", "george", "jane", "elroy"); my @name = map @$_, @HoA{ keys %HoA }; Why not my @name = m

Re: Appending array from HoA elements into one single array

2004-08-24 Thread Jenda Krynicky
From: "John W. Krahn" <[EMAIL PROTECTED]> > Edward WIJAYA wrote: > > Hi, > > Hello, > > > Suppose I have this Hash of array: > > > > %HoA = { > > If you had warnings enabled then that would have produced a warning. > It should be either: > > %HoA = ( ... ); > > Or: > > $HoA = { ... }; > >

Re: Appending array from HoA elements into one single array

2004-08-24 Thread John W. Krahn
Edward WIJAYA wrote: Hi, Hello, Suppose I have this Hash of array: %HoA = { If you had warnings enabled then that would have produced a warning. It should be either: %HoA = ( ... ); Or: $HoA = { ... }; A => ["fred", "barney"], B => ["george", "jane", "elroy"], }; Is there any efficient wa

RE: Appending array from HoA elements into one single array

2004-08-24 Thread Charles K. Clarkson
From: Edward WIJAYA wrote: : Suppose I have this Hash of array: : : %HoA = { : A => ["fred", "barney"], : B => ["george", "jane", "elroy"], : }; I'll assume you mean a hash like this. Note the use of parenthesis instead of braces. my %HoA = ( A => [ qw

Appending array from HoA elements into one single array

2004-08-24 Thread Edward WIJAYA
Hi, Suppose I have this Hash of array: %HoA = { A => ["fred", "barney"], B => ["george", "jane", "elroy"], }; Is there any efficient way to append each of this HoA's array into one single array, e.g: @name = ("fred", "barney", "george", "jane", "elroy"); Regards, Edward WIJAYA SINGAPORE -- To