in reply to Re^2: Help with pushing into a hash
in thread Help with pushing into a hash
You're welcome, jemswira!
To remove the decimal values in the test2.txt data, try changing the following:
my %data = map { /(.+)\s+\|\s+(.+)/; $1 => $2 } read_file $test2;
to:
my %data = map {s/\.\d+//g; /(.+)\s+\|\s+(.+)/; $1 => $2 } read_file $ +test2;
New output to file:
Q197F8 IIV3-002R PF04947 Q91G88 IIV6-006L PF01486 PF00319
The substitution at the beginning of the map block will globally remove a decimal point followed by one or more digits. Since only the test2.txt values (not keys) contain decimal points, this should work.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Help with pushing into a hash
by jemswira (Novice) on Aug 31, 2012 at 11:48 UTC | |
by Kenosis (Priest) on Aug 31, 2012 at 15:16 UTC | |
by jemswira (Novice) on Aug 31, 2012 at 15:43 UTC | |
by Kenosis (Priest) on Aug 31, 2012 at 16:37 UTC | |
by jemswira (Novice) on Aug 31, 2012 at 16:43 UTC | |
|
In Section
Seekers of Perl Wisdom