Looks to me like your routine is reinventing the wheel. Take a look at
grep, which handles regexen explicitly. Here's my go at a solution, though I'm not sure of the rules concerning valid alias names, so twiddle with those as appropriate. I'm also making even less of an attempt at verifying the destination address than
BlueLines, because that's an entirely different problem. Also remember that things like
/dev/null are valid targets.
#!/usr/bin/perl -w
use strict;
my @valid = grep { !/^[\w-]+:\s*\S+$/ } <>;
# do some stuff with @valid
If the entire functionality of your program is to strip out the irrelevant lines, this is easier (fore! ;-).
perl -ne '/^[\w-]+:\s*\S+$/ and print' < /etc/aliases