in reply to regex help!

Hi,
as far as I understood this, the OP searched for this (although it is not a regex)
#!/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

Regards,
svenXY