in reply to Something is wrong with this pattern

The value inside $operator (supposed to "." in case of "11.5") is interpreted as special character inside regular expression. Escape its special meaning as following

$celldata=~m{(.+?)\Q$operator\E(.*)}

You can better use split for this if you have only one "$operator" in a string

($left_str, $right_str) = split(/\Q$operator\E/, $celldata);

-- Regards - Samar

Replies are listed 'Best First'.
Re^2: Something is wrong with this pattern
by tej (Scribe) on Dec 24, 2010 at 07:30 UTC

    Thank you samarzone

    It is working fine now...