in reply to regex to split a line

Lots of people seem very keen to give you what you asked for (a regex) without pointing out that this is a perfect opportunity to use split (with its optional third argument).

$data = 'username Real Name|email@gmail.com|2|30|'; my ($key, $val) = split /\s+/, $data, 2; $users{$key} = $value;
--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg