in reply to
Re^2: write and read the same file not display the output
in thread write and read the same file not display the output
Hello ulaksh, Im guessing youve commented out your print "$_"; on purpose there. Anyway your getting yelled at because when the regex doesnt make a match, $a is not getting defined at all, so it is still undefined. You then try to use it on the next line print $a; You cant print $a because it has no value. It is undefined at the moment. This is also the reason your not getting anything printed to screen.
maybe you can try this instead? :
print $1 if /^($name)$/;