-----Original Message----- From: Charles K. Clarkson [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 03, 2006 4:10 PM To: 'Perl Beginners' Subject: RE: has key/value pairs
Smith, Derek wrote: : I need to create a hash with a key/value pair as text:nontext : like so: : savecrash as the key and 1 as the value : : savecrash_dir as the key and /var/adm/crash as the value. : : for (;<SC>;) { : : if ( /(?i)savecrash=/ || /(?i)savecrash_dir=\W+\w+/ ) { : : chomp; my( $key, $value ) = split /=/; $vg{$key} = $value; : $vg{$_}++; Delete that line. You can read more about the split() function in the perl documentation. : : } : : } ***************************************** Excellent... thank you. Before sending the email question, I was trying to use split to get rid of that and could not get it to work as I was using <code> For (<FH>) If (/pattern/) { split /\=/ ,$_ /; $vg{$_}++ } } </code> Why didn't this work? derek Cardinal Health -- Working together. For life. (sm) _________________________________________________ This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk - Portuguese - Svenska: www.cardinalhealth.com/legal/email -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>