Beri-Veera-ext, Reddy (n.a.) wrote on Tue, Jul 10, 2007 at 09:37:37AM +0200:
> I want to add to Associative Array dynamically > (means=> I don't exact size of Associative Array). That's what these beasts are meant for in the first place. RTFM. > Ex: In test.txt I have the fallowing data. > red,danger > blue,going smooth > yellow, pending > Green, accept. > ....etc > > I have to add these values to Associative Array > like > %info= (red =>danger > blue =>going smooth > yellow => pending > Green=>accept. > ...etc) > > For these I have read the test.txt line by line and add to %info. > Please guide me how to do this.... [EMAIL PROTECTED]:~$ perl -e 'while (<>) {/(.+),(.*)/ and $info{$1}=$2}; use Data::Dumper; print %info."\n".Dumper(\%info);' red,danger blue,going smooth yellow, pending green,accept 4/8 $VAR1 = { 'green' => 'accept', 'blue' => 'going smooth', 'red' => 'danger', 'yellow' => ' pending' }; > Karunakar Reddy B.V. > BSH Bosch Siemens Hausgeraete GmbH Are you trolling? _______________________________________________ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs