#!/usr/bin/perl use strict; use warnings; my $key; my %data; while ($key = <DATA>) { chomp $key; my $val = <DATA>; chomp $val; push (@{$data{$key}}, $val); } print "First occurrence of U: " . $data{'U'}[0] . "\n"; print "Second occurrence of Pu: " . $data{'Pu'}[1] . "\n"; __DATA__ NP 111 U 222 Pu 333 NP 2-111 U 2-222 Pu 2-333
In reply to Re: regex help!
by svenXY
in thread regex help!
by igotlongestname
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |