Click to See Complete Forum and Search --> : How do I start?


mighty_tracer
06-07-2003, 01:19 AM
Hey, bros!
I found some info on the perl and decide to learn it.
But the book I have is for FreeBSD.

Can somebody tell me how do I create a perl file, or how do I start, for Linix sake?

Thanks.

P.S. I'm using bash console.

error27
06-07-2003, 02:35 AM
everything for freebsd aplies to linux as well.

create a text file with any editor that says:
[CODE]
print "hello world\n";
{/CODE]

type: perl <filename>

DragonHead
06-07-2003, 07:46 AM
Don't forget to declare the perl path on the first line...

The "basics" of perl is the same, no matter what the OS your using. The only time there is a difference, is if your getting into OS type stuff, then there would be a difference between say "normal" perl and winperl.

dchidelf
06-07-2003, 09:43 AM
If you are only ever going to run the perl program by typing
perl <scriptname>
you don't need to include the #!/usr/bin/perl on the first line.

#!/usr/bin/perl has nothing to do with perl at all.
If a text file is set to be executable the shell reads the first line of the file and if it starts with #! it uses whatever program that follows to interprit the contents of the file.

If you want to run the script by just typing the scriptname you will need to add #!/usr/bin/perl as DragonHead said.

mighty_tracer
06-07-2003, 10:46 AM
When I just enter "perl <filename>", bash sais that it cannot open perl script "<filename>" : No such file or directory (Even if I add directory).

If I enter "!#/usr/bin/perl <filename>", bash sais the same.

If I enter "!#/usr/bin/perl", bash takes me to some text environment. When I enter the code, I don't know how to activate it, or how to exit from the code.

DragonHead
06-07-2003, 11:21 AM
Originally posted by dchidelf
If you are only ever going to run the perl program by typing
perl <scriptname>
you don't need to include the #!/usr/bin/perl on the first line.


I tend to forget about that. I really enjoy these forums. I've learned a lot just by reading other peoples ideals/info.

sharth
06-07-2003, 12:02 PM
#!/usr/bin/perl
print "hello world\n";

he meant to use brackets [ when he acidentily used a {, screwed up the vbcode for the forums. there shouldn't be any [code] stuff in the actual code.