#!/usr/bin/perl use strict; use warnings; my $brand = shift || die "Must give a brand\n"; my %data; while () { chomp; next unless /^\[$brand\]$/ .. !/\S/; next if /^\[/; next unless /\S/; my ($k, $v) = split /\s*=\s*/, $_, 2; $data{$k} = $v; } foreach (keys %data) { print "$_ => $data{$_}\n"; } __END__ [NEWBRAND] #LOGIN FOR THAT PARTICULAR BRAND #Get the LOgin and Password according to Brand [AN] LOGIN = H006698 PASSWORD = $"?Y?? [AZ] LOGIN = H006699 PASSWORD = ???S? [CL] LOGIN = H007985 PASSWORD = 8?|?E?0 [CM] LOGIN = H006897 PASSWORD = $"?Y?? [CU] LOGIN = H006701 PASSWORD = $"?Y?? [GM] LOGIN = H006703 PASSWORD = 8?|?E?0