#!perl use strict; use warnings; use Data::Dumper; my $string = ""; while() { $_ =~ s/\n/ /g; # (trick one) $string .= $_; } my %hash = split (/\s*:\s+|\s\s+/, $string); # (trick two) print Dumper( \%hash ); __DATA__ VLAN : 1 Status : Enabled FID : 1 Name : DEFAULT VLAN VLAN Type: Permanent Last change: 2009-08-31 16:48:45 Egress Ports: host.0.1 Forbidden Egress Ports: ge.3.39 Untagged Ports: host.0.1 #### $VAR1 = { 'Last change' => '2009-08-31 16:48:45', 'Status' => 'Enabled', 'Forbidden Egress Ports' => 'ge.3.39', 'FID' => '1', 'VLAN' => '1', 'Untagged Ports' => 'host.0.1', 'Egress Ports' => 'host.0.1', 'Name' => 'DEFAULT VLAN', 'VLAN Type' => 'Permanent' };