On Wed, Nov 14, 2012 at 9:05 AM, jet speed <[email protected]> wrote:
> Hi
> Is there a way, i can build an %hash from a file as Input. Appreciate you
> help with this.
>
> file.txt
> ----------------
>
> 22:5a => 10.00.00.00.aa.56.9b.7a
> 32:9c => 10.00.00.00.aa.46.9b.33
> a2:cc=> 10.00.00.00.aa.5a.9b.63
Assuming no anomalies/surprises in file.txt:
use File::Slurp;
use strict;
use warnings;
my @lines = read_file( 'file.txt', chomp=>1 );
my %hash = map { split( /\s*=>\s*/,$_ ) } @lines;
--
Charles DeRykus
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/