Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use PerlIO;
use Data::Dumper;
open my $fh, '<', 'foobar';
warn Dumper(PerlIO::get_layers($fh, details => 1)); # ファイルハンドルのencodingはこの時点では変更されていない
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use PerlIO;
use Data::Dumper;
open my $fh, '<', 'foobar';
warn Dumper(PerlIO::get_layers($fh, details => 1)); # $fhのencodingは変更されていない
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Encode;
use Digest::MD5;
use v5.010;
my $str = 'ジムに行き筋肉ムキムキ';
#!/usr/bin/env perl
use strict;
use warnings;
use Digest::MD5;
use feature qw/say/;
my $str = 'foobar';
my $ctx = Digest::MD5->new;
#!/usr/bin/env perl
use strict;
use warnings;
use Digest::MD5;
use feature qw/say/;
my $str = 'foobar';
my $ctx = Digest::MD5->new;
#!/usr/bin/env perl
use strict;
use warnings;
my $str = 'hel"lo';
$str = eval "$str"; # => !!!失敗する!!!
print $str;
#!/usr/bin/env perl
use strict;
use warnings;
use B;
my $str = B::perlstring('hel"lo');
$str = eval "$str";
print $str; # => hel"lo
package HTTP::Body::JSON;
use strict;
use warnings;
use parent qw(HTTP::Body);
use JSON::XS;
use HTTP::Body;
use Encode qw(encode_utf8);
# based on tokuhirom-san's code
#!/bin/sh
base_branch=$1
if [ -z $base_branch ] ; then
echo 'usage: git-delete-merged-branches-with-remote [base_branch]' >&2
exit 1
fi
git show-ref --verify --quiet refs/heads/$base_branch
if [ $? -ne 0 ] ; then
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw/say/;
use Coro;
use Coro::AnyEvent;
my $var;