If there is a symbol in a string that we are going to print or use further in a perl program but when we execute it the interpreter or compiler is not getting correct meaning of that string . In this condition compiler gives a error ‘Missing operator before’ ”your symbol “.
A bareword is series of characters outside of a string that PERL doesn’t recognize.
We can also take a example to understand the mean of bareword
#!/usr/bin/perl
use warnings;
print 255 , “\n”;
print 0377 , “\n”;
print 0b11111111, “\n”;
print 0xFF , “\n”;
The output of each print statement is
255
255
255
255
But if we turn the code of above program as :-
#!/usr/bin/perl
use warnings;
print 0378 , “\n”;
print 0b11111112, “\n”;
print 0xFG , “\n”;
Illegal octal digit ‘8’ at line 3 , at the end of line.
Illegal binary digit ‘2’ at line 4 , at the end of line.
Bareword found where operator expected at line 5 , near “0xfG”
(Missing operator before G)
Syntax error at line at line 5 , near “0xfG”.
Its Perl not PERL
ReplyDeleteand don't forget to use strict pragma in your script.
Many thanks for the suggestion.
Delete