homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam

The Geek Culture Forums


Post New Topic  New Poll  Post A Reply
my profile | directory login | | search | faq | forum home
  next oldest topic   next newest topic
» The Geek Culture Forums   » Other Geeky Stuff   » Ask a Geek!   » Perl - 10s for you, 30 min for me.

 - UBBFriend: Email this page to someone!    
Author Topic: Perl - 10s for you, 30 min for me.
littlefish
BlabberMouth, a Blabber Odyssey
Member # 966

Member Rated:
4
Icon 1 posted August 08, 2009 06:35      Profile for littlefish   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
I'm trying to learn perl, and it is OK so far, but I am having a shebang problem.
An example is below, just a quick exercise to show different types of strings. If on the command line I type "perl float.pl", then everything is alright. If I type "float.pl", I get "-bash: float: command not found".

I'm running mac os 10.5.7, and the script was written in vi. Obviously I can work around it, but it is annoying me.

code:
#!/usr/bin/perl
use strict; use warnings;

my $x= 0.1+0.1+0.1;
my $y=0.3;
print $x, "\t", $y, "\t", $x-$y, "\n";

It may be the OS, or something more sinister, but I'm no wizard, and my poking around in *nix is limited. Google does not seem to help, unless there is a non-printing character that has somehow munged up the line.

EDIT: and another thing, I've hit the file with chmod to make it executable, so that isn't it. However, if I try ls -l all the other files have [email protected] What does the @ mean?

Posts: 2421 | From: That London | Registered: Nov 2001  |  IP: Logged
Metasquares
Highlie
Member # 4441

Member Rated:
5
Icon 1 posted August 08, 2009 07:07      Profile for Metasquares   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
quote:
If I type "float.pl", I get "-bash: float: command not found".
Try "./float.pl"... Bash probably isn't finding your script in your PATH to begin with, so it's not even getting to the point where it reads the shebang. You can also add "." to your PATH environment variable and you'll be able to use it without the "./"

The @ after the file means the file is a symbolic link. Those are "shortcuts", while your Perl script is a normal file, so it's perfectly normal that your script doesn't have an @ after it.

Posts: 664 | From: Morganville, NJ | Registered: Oct 2005  |  IP: Logged
littlefish
BlabberMouth, a Blabber Odyssey
Member # 966

Member Rated:
4
Icon 1 posted August 08, 2009 07:35      Profile for littlefish   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
That's it sorted, thanks a lot.
Posts: 2421 | From: That London | Registered: Nov 2001  |  IP: Logged
The Famous Druid

Gold Hearted SuperFan!
Member # 1769

Member Rated:
4
Icon 1 posted August 08, 2009 13:38      Profile for The Famous Druid     Send New Private Message       Edit/Delete Post   Reply With Quote 
Q) What's the difference between perl and line noise?

A) If you stare at it for long enough, you start to see meaning in line noise.

--------------------
If you watch 'The History Of NASA' backwards, it's about a space agency that has no manned spaceflight capability, then does low-orbit flights, then lands on the Moon.

Posts: 10668 | From: Melbourne, Australia | Registered: Oct 2002  |  IP: Logged
dragonman97

SuperFan!
Member # 780

Member Rated:
4
Icon 1 posted August 08, 2009 16:51      Profile for dragonman97   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
quote:
Originally posted by The Famous Druid:
Q) What's the difference between perl and line noise?

A) If you stare at it for long enough, you start to see meaning in line noise.

Hey...I resemble that remark. [Razz]

--------------------
There are three things you can be sure of in life: Death, taxes, and reading about fake illnesses online...

Posts: 9331 | From: Westchester County, New York | Registered: May 2001  |  IP: Logged
littlefish
BlabberMouth, a Blabber Odyssey
Member # 966

Member Rated:
4
Icon 1 posted August 09, 2009 12:45      Profile for littlefish   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
Perl killed my hard drive!

It is now with the geniuses getting fixed.

Posts: 2421 | From: That London | Registered: Nov 2001  |  IP: Logged


All times are Eastern Time  
Post New Topic  New Poll  Post A Reply Close Topic    Move Topic    Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

Contact Us | Geek Culture Home Page

2015 Geek Culture

Powered by Infopop Corporation
UBB.classicTM 6.4.0



homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam