creating hash from scalar variable



hello,

Can someone help me correct this code.

if i print, it only print the first line.

Goksie

#!/usr/bin/perl
use strict;

my $test =
'NAS-IP-Address = 192.168.42.1
Quintum-NAS-Port = "0 0/0/c1dc2a26"
NAS-Port-Type = Async
User-Name = "192.168.42.8"
Called-Station-Id = "8600508208079"
Calling-Station-Id = ""
Acct-Status-Type = Stop
Acct-Delay-Time = 0
Acct-Input-Octets = 0
Acct-Output-Octets = 0
Acct-Session-Id = "000000C0000012F5"
Acct-Session-Time = 245
Acct-Input-Packets = 0
Acct-Output-Packets = 0
Service-Type = Login-User
Quintum-AVPair = "h323-ivr-out=ACCESSCODE:8600508208079"
Quintum-h323-conf-id = "34363262 65383833 32656366 00340000"
Quintum-AVPair = "h323-incoming-conf-id=34363262 65383833 32656366
00340000"
Quintum-h323-gw-id = "ng-la"
Quintum-h323-call-origin = "answer"
Quintum-h323-call-type = "VoIP"
Quintum-h323-setup-time = "22:58:10.220 UTC Sun Apr 22 2007"
Quintum-h323-connect-time = "22:59:09.550 UTC Sun Apr 22 2007"
Quintum-h323-disconnect-time = "22:59:09.550 UTC Sun Apr 22 2007"
Quintum-h323-remote-address = "192.168.42.8"
Quintum-h323-disconnect-cause = "1f"
Quintum-h323-voice-quality = "0"
Quintum-Trunkid-In = "192.20.42.8"
Quintum-Trunkid-Out = "10.15.115.79"
h323-incoming-conf-id = "34363262 65383833 32656366 00340000"
Client-IP-Address = 192.168.42.1
Acct-Unique-Session-Id = "87d380e1881d226c"
Timestamp = 1177282824';

my %test = my($fname, $fvalu)=split(/=/, $test);
foreach(keys %test)
{
print "$_ --- $test{$_}";
}

OUTPUT
NAS-IP-Address --- 192.168.42.1
Quintum-NAS-Port ---


.



Relevant Pages