PDA

View Full Version : perl - command not found



adit
December 14th, 2011, 08:46 AM
This is my perl script

#!/usr/bin/perl
$x=2;
print $x;
I expect the program outputs 2. But I get the following output.
line 2: =2: command not found

Lars Noodén
December 14th, 2011, 10:55 AM
I'm unable to duplicate your error but you might try adding warnings and restricting unsafe constructs to see if it will generate clues:



#!/usr/bin/perl

use strict;
use warnings;

my $x=2;
print $x;

karlson
December 14th, 2011, 03:28 PM
This is my perl script

#!/usr/bin/perl
$x=2;
print $x;
I expect the program outputs 2. But I get the following output.
line 2: =2: command not found

Do you by chance ran it like this:



bash ./script