What you want to do can be accomplished fairly easily if you read perlintro and perlretut. The last bit of information you need is that you can embed variables into regular expressions, usually one uses \Q...\E aka quotemeta for this, to prevent special characters inside the variables from being interpreted as regular expression metacharacters.
my $user = "one"; while (my $line=<DATA>) { chomp($line); print "match on $line\n" if $line=~/^\Q$user\E:/; } __DATA__ foo:bar:quz one:two:three a:b:c
Prints "match on one:two:three".
In reply to Re: Most Efficient Way to match this
by Anonymous Monk
in thread Most Efficient Way to match this
by jmneedhamco
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |