in reply to Re^4: multiple values per key
in thread multiple values per key

Read the join docs.


DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^6: multiple values per key
by convenientstore (Pilgrim) on Jul 25, 2007 at 02:44 UTC
    I still do not get it, @{$data1{$callid}} contains something like
    INVITE 100 180 200 INVITE 503 ACK
    so when I do below I expected results to be
    INVITE100180200
    INVITE503ACK
    But instead I get scalar values in return.. why??
    foreach $callid (sort keys %data1) { my @fields = join('', split(/[ +\t]/, @{$data1{$callid}})); print "@fields\n"; }
      I was able to get it done using below.. Is this because reference is scalar?
      foreach $callid (sort keys %data1) { my @fields = @{$data1{$callid}}; for my $element (@fields) { $element =~ s/\s+//g; print "$element"; } print "\n"; }