Načtení souboru do stringu

local $/=undef;
open FILE, "myfile" or die "Couldn't open file: $!";
$string = ;
close FILE;

CPAN

perl -MCPAN -eshell

Zkouška: perl -e'print "Modul dostupny\n";' -MGD::3DBarGrapher

sudo vi /usr/lib/perl5/site_perl/5.8.8/GD/3DBarGrapher.pm

Formatovani kodu

perltidy -gvu program.pl
perltidy -html program.pl

reference dereference

http://perldoc.perl.org/perlreftut.html

data struktury

use Data::Printer;
print p($_);

debug

If you're on Linux, use the strace utilitiy to tell you what your script is doing while it hangs. Either run
strace -f perl mycode.pl input_file.txt > output.txt

or start your script normally, wait till it hangs, find out the PID of the script process and execute
strace -f -p

strace prints to STDERR, so you'll see the strace output normally in your terminal while STDOUT still gets written to the output file. It will tell you what the process is doing on a system call level. To find out where it hangs at the perl level you could execute it in the debugger and step through until it hangs.

perl -d mycode.pl input_file.txt > output.txt

utf znaky do DB (TBarta)

s/[^\r\n\t\x20-\x7E\xA0-\xFF]//

DBI

http://dbi.perl.org/
https://metacpan.org/pod/DBI

utf8

  • Wide character in print
    use Encode qw(encode_utf8);
    $str=encode_utf8($str);

You have utf8-encoded characters where Perl is expecting to see bytes. You probably need to encode() your data before it gets to this point.