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 DDP; | |
my @files = qw/papix.pl moznion.pm macopy.py boolfool.vim/; | |
sub map_bak { | |
my $array_ref = shift; | |
return [ map {$_ . '.bak'} @{$array_ref} ]; |
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 Mojolicious::Lite; | |
my @bar = (); | |
get '/' => sub { | |
my $self = shift; | |
$self->stash(hoge => \@bar); | |
$self->render('index'); | |
}; |
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 Mojolicious::Lite; | |
my @entries = {}; | |
get '/' => sub { | |
my $self = shift; | |
$self->stash(entries => \@entries); | |
$self->render('index'); | |
}; |
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 Mojolicious::Lite; | |
get '/' => sub { | |
my $self = shift; | |
$self->stash(title => 'fizzbuzz_practice'); | |
$self->render('index'); | |
}; | |
app->start; |
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; | |
print "Input a number or a word.\n"; | |
my %english = ( | |
#ここに大量の単語を入れる | |
abandon => 'を捨てる', | |
abide => 'に従う|我慢する|住む', |
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; | |
print "Input a date with 'YYYYMMDD' or 'YYYY/MM/DD' or 'YYYY-MM-DD'.\n"; | |
my $day = [qw( | |
Sunday | |
Monday | |
Tuesday |
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 utf8; | |
use feature 'say'; | |
my $switch = 'o'; | |
#my $switch = 'u'; | |
my %count; |
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 feature 'say'; | |
{ | |
my $count = 0; | |
sub counter { | |
say $count++; | |
} |
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/ruby | |
# http://magazine.rubyist.net/?0009-YAML | |
# | |
# 引数を使う場合 | |
#str = ARGF.read() # 入力をすべて読み込む | |
#data = YAML.load(str) # パースする | |
# | |
# コード上でファイルを指定する場合 | |
#data = YAML.load_file('data.yml') |
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
my @array = <DATA>; | |
my $n = 1; | |
for my $line (@array) { | |
print "$n: $line"; | |
$n++; | |
} | |
__DATA__ | |
apple | |
orange | |
lemon |
OlderNewer