On Thu, Nov 15, 2012 at 8:46 AM, Dr.Ruud <rvtol+use...@isolution.nl> wrote:

> On 2012-11-15 03:07, Uri Guttman wrote:
>
>       my %hash = read_file( 'file.txt' ) =~ /^(.+)\s*=>\s*(.+)$/mg ;
>>
>
> Trailing whitespace in the keys? Skipping empty values?
>
>   my %kv= read_file( 'file.txt' ) =~ /^(.+?)\s*=>\s*(.*)/mg;
>
> and without File::Slurp:
>
>   my %kv= map m/(.+?)\s*=>\s*(.*)/, <$fh>;
>
> (all untested)
>
> --
> Ruud
>
> ----------------------------------------------------------
>



   Hi All.


  Thanks for you help and tips, appreciate it.

  I was able to build the hash, however the file contains approx 10,000
entries. but while i print the hash i get only approx 1300 lines or
key=>values.

 i guess its because, the file has duplicate entries. example below

  file.txt
> ----------------
>
   22:5a => 10.00.00.00.aa.56.9b.7a
   22:5a => 10.00.00.00.aa.57.99.8a
   32:9c => 10.00.00.00.aa.46.9b.33
   a2:cc => 10.00.00.00.aa.5a.9b.63
   a5:cc => 10.00.00.00.aa.5a.9b.63
   b2:cc => 10.00.00.00.aa.5a.9b.63

How do i build all the entries into hash including the duplicates on both
sides keys and values.

Appreciate your help.

Thanks
Sj.


To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>

Reply via email to