Perl日記

日々の知ったことのメモなどです。Perlは最近やってないです。

fat comma使うと綺麗に見えた

以下。

bless $argv => __PACKAGE__;

binmode $fh => ':utf8';

my @grep = grep /abc/ => @poems;

my $index = index $str => $search;

my $join = join ' & ' => @words;

push @array => $pushed;

my ($first, $second, $third) = unpack('AAA' => 'MIX');

my @words = split /,/ => $sentence;

my $Subject = substr 'They are running.', 0 => 4;

自分の中では読みやすく見える。
他には、

use utf8;
use Encode qw/ encode from_to /;
my $w = 'あいうえお';
$w = encode('utf8' => $w);
from_to($w, 'utf8' => 'sjis');

なんかもわかりやすいと思う。




逆に、やってみて、紛らわしくなったもの。

my ($one => $two);

grep 777 >= $_ => @numbers;

open my $fh => '<' => '/etc/passwd';