Have u run your code?\
Here u cant chomp because you have key/value pairs spans more than one
line..........

Thanks & Regards
Anirban.

On Fri, Apr 1, 2011 at 4:37 PM, Ramprasad Prasad <ramprasad...@gmail.com>wrote:

> See Inline comments
>
> use strict;
>> use warnings;
>> my $fname = $ARGV[0];
>> open my $RFH,'<',$fname;
>>
>> while (<$RFH>) {
>>        next unless /:/ and  my %field = /(.*?):(.*?)/mg;  # Wrong
>>
> # I would prefer doing this
>             chomp;
>            if(/^(.+?)\:(.+?)/){ $field{$1}=$2;}
>     }
>
>
>
>
>>        foreach my $key (keys %field ) {
>>                print "KEY=[$key]------VALUE=[$field{$key}]\n";
>>        }
>> }
>>
>> But I am not getting the desired result.
>>
>> Thanks & Regards in advance
>> Anirban Adhikary.
>>
>> --
>> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
>> For additional commands, e-mail: beginners-h...@perl.org
>> http://learn.perl.org/
>>
>>
>>
>
>
> --
> Thanks
> Ram
>   <http://www.netcore.co.in/>
>
>
>
>
> n <http://pragatee.com>
>
>

Reply via email to