http://www.perlmonks.org?node_id=858989

suniln has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, I I have following piece of code to fetch intermediate and last node of a string. for e.g the input lines are as follows. C:\abc\dfg C:\abc\dfg\#@$#@$@ $key="C:\abc\dfg"; if( $line =~ /$key\\\S+\\/){ # if this is not end node ($pat)=$line=~/$key\\(\S+)\\/; }else{ # if end node ($last_node)=$line=~/$key\\(.*)/; } What is wrong in this reg exp... Thanks, Sunil