Member Avatar for susuoi

I'm learning perl now. By using whereis command, I found out where perl command is.
$whereis perl
/usr/bin/perl
I make a program and tried to execute it. But I got error message like this one.
$perl yahoo_search.pl #!/usr/bin/perl
-bash: !/usr/bin/perl: event not found
Can somebody tell me what I should do to solve this problem?

The ! character is the default history modifier used by the bash shell (and nothing to do with perl). ! followed by all sorts of things, does all sorts of things.

Eg.

ls file.pl
cat !$

!$ refers to the last parameter of the previous command, so this would be in effect the same as typing cat file.pl If you really want a ! on the command line, you need to escape it with \ $perl yahoo_search.pl #\!/usr/bin/perl Also, # is regarded as a comment by bash.

The #!/usr/bin/perl is usually the first line of whatever prog.pl file you're creating. More specifically, I go with #!/bin/perl -w

hi,
just use perl yahoo_search.pl . Also remember to include #!/usr/bin/perl as first line in source code, will help later if you want to make the file executable.

kath.

Hi, This post is very informative, however I would like some specific information. If someone can help me then please send me a private message. Best Regards,

Actually, can anyone who is able to help not send a PM but answer the question here, in forum, so that all DaniWeb members can benefit.

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.