Perl - Porting Korn To Perl In AIX Platform
I'm in the process of brushing up my skills using Perl. As a starter, I tried to convert an existing KSH script that I wrote to Perl.
Just added: Code:
#!/usr/bin/perl Renamed my script from bancsadm.ksh to bancsadm.pl (just for identification purpose) and called the new file. I was expecting errors, but the script fired beautifully. I invoked the script again as: Code:
perl bancsadm.pl What I'd like to know is why the perl environment did not fire the first time even though I included #!/usr/bin/perl at the start of the script. |
Is the .pl file marked with executable permission?
I'm also not sure if AIX gives you a "bad interpreter" error if there's something wrong with the shebang line (line starting with #!). So you might want to check if /usr/bin/perl is an existing, executable file (Perl interpreter). You could for instance try calling Code:
/usr/bin/perl |
Sure it is marked as an executable. And perl is definitely an existing executable:
Code:
root@prapbc[/home/bancsadm] #which perl |
Quote:
|
I understand :-). What I meant was the script executed as a normal KSH script at first and threw errors only when I explicitly invoked the same from the CLI prefixing it with 'perl'.
Hope it makes sense now. |
Quote:
Code:
#!/usr/bin/perl Code:
/full/path/to/bancsadm.pl |
Even now the script is firing in a perl environment only if prefixed and invoked as:
Code:
perl bancsadm.pl |
Quote:
Code:
ls -ltr /full/path/to/bancsadm.pl Also, publish here output of Code:
head -1 /full/path/to/bancsadm.pl ... Did you edit your script on Windows ? What does Code:
file /full/path/to/bancsadm.pl |
Please find below the information requested -
Code:
root@prapbc[/] #ls -ltr /home/bancsadm/bancsadm.pl |
Quote:
Code:
perl -V Also, try to replace Code:
#!/usr/bin/env perl Code:
#!/usr/bin/perl What does Code:
ls -ltd /home/bancsadm |
All times are GMT -5. The time now is 09:23 PM. |