in reply to Most Efficient Way to match this

To get the first field of the line, assuming the line is stored in the $line variable you could do this, using the split function:
my @fields = split /:/, $line; my $linefraq = $fields[0];
Or, shorter:
my $linefraq = (split /:/, $line)[0];
You could also use a regular expression:
$linefraq = $1 if $line =~ /^(\w+?):/;

Je suis Charlie.

Replies are listed 'Best First'.
Re^2: Most Efficient Way to match this
by kroach (Pilgrim) on Mar 30, 2015 at 22:02 UTC
    One more way:
    my ($linefraq) = split ':', $line;