use strict; use warnings; for my $string ("BCInletTemperature = 90[C]", "BCInletTemperature = 33.56[C]") { print "$1\n" if $string =~ / = \s* ([0-9.]+) \[ /x; } #### 16:59 >perl 1906_SoPW.pl 90 33.56 17:03 >