This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------- | |
# http://www.google.com/#q=pavel+curda+gesche+haas | |
#------------------------------------------------- | |
TO_GESCHE_HAAS: | |
until ($I_have_sex_with_you) { | |
say "I will not leave Berlin. Deal?"; | |
die unless <STDIN> =~ m{yes|ok|fine}ig; | |
#she's gotta be kidding me |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use LWP::UserAgent; | |
$req = HTTP::Request->new( | |
'HEAD' => 'http://fis.vse.cz' | |
); | |
$res = LWP::UserAgent->new( | |
agent => 'Googlebot/2.1' | |
)->request($req); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use POSIX; | |
exit 2 unless &is_prime(pop @ARGV); | |
sub is_prime { | |
my $num = shift || 0; | |
return if $num<2 | |
|| ($num%2==0 && $num>2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> echo "Zanzibar, zambeZi" | perl -le "@_= <STDIN> =~ m/z/g; print scalar(@_);" | |
$> echo "Zanzibar, zambeZi" | perl -le "print (scalar(split /z/, <STDIN>) - 1);" | |
-- | |
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use feature q{say}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package VS module | |
"Packages and modules are two completely separate and distinct features" | |
=> http://qntm.org/files/perl/perl.html | |
conventions | |
http://perlmaven.com/how-to-create-a-perl-module-for-code-reuse | |
-- | |
use VS require | |
http://linux-forum-karthik.blogspot.cz/2011/06/use-vs-require-in-perl.html | |
%INC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use autodie; | |
my $note = \&diary; | |
sub diary { | |
my %tasks; | |
chomp(my($date,$task) = @_); | |
$tasks{$date} = $task; | |
### add FILEHANDLE, have a file! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use open qw(:std :utf8); | |
use utf8; | |
################################# | |
# EXAMPLE # | |
# http://jurcapavel.cz/books.pl # | |
################################# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.010.1; | |
use strict; | |
use warnings; | |
for (@ARGV) { | |
say "[ $_ ]"; | |
say " - $_" for file_test($_); | |
} | |
sub file_test { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use utf8; | |
use open qw(:std :utf8); | |
my %word; | |
#single-space-literal split pattern cuts out leading spaces | |
#see http://perldoc.perl.org/functions/split.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -T | |
#PERL5OPT=-T | |
use strict; | |
use warnings; | |
use LWP::UserAgent; | |
my $dotaz = sestav_dotaz( | |
zpracuj(&nacti) #ref eq 'HASH' | |
); | |
my $odpoved = posli_dotaz($dotaz); |
OlderNewer