Tutorials/Perl Tutorial

From ThorstensHome
Revision as of 11:51, 24 April 2008 by WikiSysop (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

What I had to learn about perl:

open files

For writing

open(FILE, ">"."$filename"); 
print(FILE "hello world");

functions with parameters

In any function (sub) you can access the parameters only via

$_[0]

for the first parameter

$_[1]

for the second parameter and so on.

preg_replace

Preg_replace in perl works like this:

 $url =~ s\http://\\g;

$url then contains what was in before, but without http://