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;
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: regex to split a line
by davorg
in thread regex to split a line
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |