use strict; my $line = "this is a test=234567 line"; my ($value) = $line =~ /.*test=(\d+)/; print $value;