Member Avatar for susuoi

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

Recommended Answers

All 4 Replies

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.


cat !$

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

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

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


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.


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.