Hello all mates, I am a new user to this site and a beginner with PERL. I am trying to get input form keyboard and the am comparing it with stored value but its not working, instead if i dont take value from keyboard and hard write it in the code then it works.
Problem Elaboration: When i run above mentioned program and take D or NV as input the if condition fails. --------------------------------------------------------Non-working code: #! usr/bin/perl -w $dynamic = 'D'; $nvolatile = "NV"; print ("Enter class: "); $storage = <STDIN>; if(($storage eq $dynamic) || ($storage eq $nvolatile)) { print("\n $storage"); print("\n Done"); } else { print("\n $storage"); print("\n Wrong Class"); }
Working Code: #! usr/bin/perl -w $dynamic = 'D'; $nvolatile = "NV"; print ("Enter class: "); $storage = 'D';#<STDIN>; if(($storage eq $dynamic) || ($storage eq $nvolatile)) { print("\n $storage"); print("\n Done"); } else { print("\n $storage"); print("\n Wrong Class"); }
------------------------------------------------------ Please help out to clarify my concept if there is any missing point.
In reply to Error with User defined data by a.alandkar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |