Problem in perl scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem in perl scripting
# 1  
Old 10-09-2010
Problem in perl scripting

I want to use perl scripting for string manipulation. i have tested perl path in linux. it works. i have written small script in perl.

Code:
#!/usr/bin/perl
print "Enter your name" ;
$name = <stdin> ;
print length($name) ;

it is giving me error"unrecognized token" in every line. can anyone help me?

Last edited by admc123; 10-12-2010 at 09:02 AM.. Reason: Code tags
# 2  
Old 10-09-2010
What error do you get?
# 3  
Old 10-09-2010
Do a chomp on $name
# 4  
Old 10-11-2010
what error u are getting??
# 5  
Old 10-11-2010
Quote:
Originally Posted by admc123
...it is giving me error. can anyone help me?
This is like saying - "My car won't start. What could be the problem?"

We don't know what the problem is! Unless you tell us more about it.

A chomp on $name is not mandatory. Not using it will print an incorrect length though.

Maybe you did not feed the script to the perl interpreter ?

tyler_durden
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl Scripting Help

Hello, Can anyone help with pearl Scripting. I'm looking for equilant pearl code which can do - OS=`uname -s` if ]; then my $HOME='/home/mqm' else my $HOME='/export/home/mqm' fi thanks (4 Replies)
Discussion started by: skrv
4 Replies

2. Shell Programming and Scripting

Need help on PERL scripting

Hi Guys; Im pretty new here in the forum and I need help on how to write a PERL script. Basically I have a file with content like these AAAAAAAAAAAAAAAAAAAAAAAAAAA BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB CCCCCCCCCCCCCCCCCCCCCCCCCCC DDDDDDDDDDDDDDDDDDDDDDDDDDD EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE... (5 Replies)
Discussion started by: ahock
5 Replies

3. Web Development

Perl scripting or shell scripting?

i am going to study any one of the scripting languages mentioned above(shell 0r perl scripting) . Which is having more scope for a fresher? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

4. What is on Your Mind?

Shell Scripting vs Perl scripting

Gents, I have been working in a Solaris/Unix environment for about 9 months. I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with... (2 Replies)
Discussion started by: Pouchie1
2 Replies

5. What is on Your Mind?

Shell scripting vs Perl scripting

Hi all, I would like to start developping some good scripting skills. Do you think it would be best to start with shell scripting or Perl? I already got a fundation, really basics, in perl. but I am wondering what would be best to be good at first. Can you please help me determine which one to... (14 Replies)
Discussion started by: Pouchie1
14 Replies

6. UNIX for Dummies Questions & Answers

Need help configuring Active Perl on Windows Vista.: Perl Scripting on Windows

Hi All, Need help configuring Active Perl on Windows Vista. I am trying to install Active Perl on Windows Vista. The version of Active Perl i am trying to install is : ActivePerl 5.10.1 Build 1006 After installing it through cmd, When i try to run perl -v to check the version, i get the... (2 Replies)
Discussion started by: Vabiosis
2 Replies

7. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

8. Shell Programming and Scripting

Need a Help:-- Perl scripting

I have a large file having mobile numbers, delivery status, status value. For example: 9975609832 SU 1 9975609832 FA 3 9861134567 SN 2 9861134567 DV 1 9975609832 NF 2 9337689162 FA 2 9337689162 SU 1 I need to pull the unique mobile numbers and the last status... (3 Replies)
Discussion started by: pritish.sas
3 Replies

9. Shell Programming and Scripting

Need help in perl scripting.

Hi, To run a perl script i am giving command like this in DOS prompt d:> perl D:\<dir_name>\<dir_name>\sample.pl Its throwing the following error while running the above syntax error at <eval 4> line 1, near "use D:" Can anyone help? (3 Replies)
Discussion started by: mvictorvijayan
3 Replies

10. UNIX for Advanced & Expert Users

Perl scripting

hi Can any one suggest me book for perl scripting on UNIX Platform. Regards (2 Replies)
Discussion started by: rochitsharma
2 Replies
Login or Register to Ask a Question