The character * is a meta-character. It has special meaning inside a pattern. To match an actual *, there are two methods. First you can quotemeta your string (see `perldoc -f quotemeta`). Second, you can do it in the pattern itself with \Q

my $pat = quotemeta( "*12345*" );

Or

$t =~ /\Q$pat\E/

PS EDIT: Oops, there is a third method. This one is tricky. If your pattern in a literal string inside Perl, you can escape the * with a backspace but you'll need two of them. The first is interpreted by string interpolation to mean a backslash character.

$pat = "\\*12345\\*";

If the pattern is in a text file you read in, you place only one backslash in it.