use strict; use warnings; use Data::Dumper; my $string = ""; my @data = (); while() { push @data, $_; $_ =~ s/\n/ /g; $string .= $_; } my %hash = (); foreach ( @data ) { chomp; my @array = split (/\s+/, $_); print Dumper(@array); print "\n"; } __DATA__ Port Alias Oper Admin Speed Duplex Type (truncated) Status Status (bps) ------------ ---------------- -------- ------- ------ ------- ------------------ vlan.0.4094 up up other host.0.1 up up 10.0M other ge.1.1 down up 10.0M half 10-t rj45 ge.1.2 down up 10.0M half 10-t rj45 ge.1.3 down up 10.0M half 10-t rj45 ge.1.4 down up 10.0M half 10-t rj45 ge.1.5 down up 10.0M half 10-t rj45