[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))) {
        print "$sub\n";
        $temp = @hash1{$sub};

Warnings would have told you that assigning a hash slice to a scalar is probably a mistake.



for ($i=0;$i<=$#$temp;$i++) {

That is usually written as:

         for my $i ( 0 .. $#$temp ) {


                push(@array1,$temp->[$i]);
        }
}
print "@array1\n";


John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to