in reply to Re^2: Regular Expression
in thread Regular Expression

It is all in the context.

Your assignment to "my $var" is in a scalar context.

The result of the regular expression is a single item in a list context.

You can get the desired result by:

my ($var) = $line =~ /.*?:(\w+):.*?$/; # Declare $var in a List contex +t.

     Potentia vobiscum ! (Si hoc legere scis nimium eruditionis habes)