Reputation: 589
I am learning perl and trying to execute this script :
#!/bin/perl
$name ="Manish";
print $name;
I saved this program with test.pl name and change its mode to make it executable :
chmod u+x test.pl
When i did which perl i got /bin/perl where perl has been installed .
Problem :- When i am running script like
perl test.pl
its fine ..
but when i am running it as ./test.pl its showing
./test.pl[6]: =Manish: not found
may be its interpreting that as a shell script.
Please help me on this.
Upvotes: 2
Views: 126
Reputation: 9262
Remove the space character in front of the #!
line.
#!/bin/perl
Not:
#!/bin/perl
Upvotes: 8