http://qs321.pair.com?node_id=863260

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

I have to extract the filename
$line="logfile = filename , abcd=eflk , cxd"; $line=~/logfile\s*=\s*(.*?),/$1/; $file=$1;
But it will not work if the line is "logfile= filename", Is there any way for this particular case to specify there could be zero or one occurrence of comma. Thanks for your help