- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- about perl
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2005 01:17 AM
01-26-2005 01:17 AM
iam new in perl language
i have hp-ux v 10.2
and perl 5
i get documentation about perl
but
when i tryed to write a simple script as follow:
my $a="hello";
print $a;
this script will return error syntax
"my $a"
i executed this file as (perl script_name.pl)
please help if there is any environment is not defiened correctly
thankx
kamal
Solved! Go to Solution.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2005 01:25 AM
01-26-2005 01:25 AM
Re: about perl
can you please attach the script?
I just copied it into a.pl and executed via:
perl a.pl
and it worked.
What does the error syntax message say?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2005 01:57 AM
01-26-2005 01:57 AM
Re: about perl
this is script NO.1 (p1.pl)
*********************************
my %var1 = (
user1 => "kamal"
user2 => "ahmed",
);
print keys %var1;
***********************************
and it is the error
***********************************
Illegal modulus of constant zero in file t1.pl at line 1, next 2 tokens "var1 ="
syntax error in file t1.pl at line 2, next 2 tokens "=>"
Execution of t1.pl aborted due to compilation errors.
---------------------------------------------
---------------------------------------------
this is script NO.2 (p2.pl)
***********************************
my $a = "hello"
print $a;
***********************************
and it is the error
***********************************
syntax error in file t2.pl at line 1, next 2 tokens "my $a "
Execution of t1.pl aborted due to compilation errors.
***********************************
i think i have problem in my environment for perl.
please help
thank you
kamal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2005 02:03 AM
01-26-2005 02:03 AM
Re: about perl
user1 => "kamal"
user2 => "ahmed",
);
You are missing a comma after "kamal".
my $a = "hello"
print $a;
You are missing a semi-colon after "hello".
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2005 02:03 AM
01-26-2005 02:03 AM
Re: about perl
my %var1 = (
user1 => "kamal"
user2 => "ahmed",
);
print keys %var1;
Here you should have a comma after kamal, but not after ahmed.
***********************************
my $a = "hello"
print $a;
This misses the required semicolon after on the first line!
---------------------------
my %var1 = (
user1 => "kamal",
user2 => "ahmed"
);
print keys %var1;
-----------------------
my $a = "hello";
print $a;
-------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2005 02:04 AM
01-26-2005 02:04 AM
Re: about perl
'my' is a perl5 keyword, and I bet you have an old perl4 (/usr/contrib/bin) that prevails in your $PATH
# perl -v
should show it
just make sure (edit /etc/PATH) that /usr/contrib/bin is last in your $PATH
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2005 02:04 AM
01-26-2005 02:04 AM
Re: about perl
add a ; after "hello"
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2005 02:06 AM
01-26-2005 02:06 AM
Re: about perl
a very quick check:
perl -e'my $a="hello";print $a'
Ensure that perl/lib is in your $PATH
Check what you are running with : which perl
Ours is in /usr/contrib/bin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2005 02:16 AM
01-26-2005 02:16 AM
Re: about perl
sorry for missing ;( i forget it only during copy script but it exist).
i tryed command
perl -v
and return (This is perl, version 4.0).
and (/usr/contrib/bin)exist in my path variable.
what can i do?
thankx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2005 02:20 AM
01-26-2005 02:20 AM
Re: about perl
download/install the latest version then try again.
http://www.perl.com/CPAN/ports/index.html
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2005 02:39 AM
01-26-2005 02:39 AM
Solutionperl4 is dead!
# echo $PATH
# /usr/contrib/bin:/bin:/usr/local/bin:/usr/bin
for sh/ksh/bash:
# export PATH=/bin:/usr/local/bin:/usr/bin:/opt/perl/bin:/usr/contrib/bin
for tcsh/csh:
# setenv PATH /bin:/usr/local/bin:/usr/bin:/opt/perl/bin:/usr/contrib/bin
Be sure to change it in /etc/PATH too!
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2005 12:15 AM
01-27-2005 12:15 AM
Re: about perl
i found perl 5 installed
but the path for perl 5 not including in /etc/PATH. (only perl 4 including)
i made the changes
and now every thing is ok
many thankx again for all
kamal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2005 12:17 AM
01-27-2005 12:17 AM