in reply to Re^4: regex not working..
in thread regex not working..

It seems likely that you aren't getting the data in the exact format you're expecting. Try adding some debugging lines:

while (my $input = <$sock>) { print "input line: **start**$input**end**\n"; # debugging if (index($input, "/QUOTE") != -1) { print " is a match\n"; # debugging my $str = $input; ($pass) = $str =~ m{/QUOTE\sPASS\s(.*?)$}; print $sock "QUOTE PASS $pass\r\n"; } else { print " not a match\n" # debugging } }

One thing I notice is that you're both reading from and writing to the filehandle in $sock. That might be possible if that's a particular kind of object, but it definitely won't work if it's a normal pipe or filehandle, so it might be a mistake.

Aaron B.
Available for small or large Perl jobs; see my home node.