Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
postfix dereference 徹底攻略 / effective postfix de...
Search
mackee
March 30, 2018
Programming
1
370
postfix dereference 徹底攻略 / effective postfix dereference
Gotanda.pm #16
mackee
March 30, 2018
Tweet
Share
More Decks by mackee
See All by mackee
ワンバイナリWebサービスのススメ
mackee
10
8k
tanukistack ライブコーディング / tanukistack live-coding
mackee
0
120
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
840
perl for shell, awk and sed programmers
mackee
2
2.5k
今更GoのWebフレームワークを作ろうとしているワケ / Why am I trying to create a Go web framework now?
mackee
1
800
database/sqlでNullを扱う歴史とsql.Null[T]の登場 / sql.Null[T] history
mackee
0
690
マイクロサービス化を利用した Goへの移行事例
mackee
0
820
PerlでつくるフルスクラッチWebAuthn/パスキー認証 / Demonstration of full-scratch WebAuthn/Passkey Authentication written in Perl
mackee
3
5k
SRE定例やその辺の取り組みをアプリケーションエンジニア目線で語る / "Observe" about SRE Meeting by Application Engineer
mackee
0
2k
Other Decks in Programming
See All in Programming
Honoアップデート 2025年夏
yusukebe
1
870
開発チーム・開発組織の設計改善スキルの向上
masuda220
PRO
17
9.2k
OSS開発者という働き方
andpad
5
1.4k
AIエージェント開発、DevOps and LLMOps
ymd65536
1
360
フロントエンドのmonorepo化と責務分離のリアーキテクト
kajitack
2
150
サーバーサイドのビルド時間87倍高速化
plaidtech
PRO
0
670
Portapad紹介プレゼンテーション
gotoumakakeru
1
130
ゲームの物理
fadis
5
1.6k
AIでLINEスタンプを作ってみた
eycjur
1
210
MLH State of the League: 2026 Season
theycallmeswift
0
180
🔨 小さなビルドシステムを作る
momeemt
2
610
TanStack DB ~状態管理の新しい考え方~
bmthd
2
360
Featured
See All Featured
Speed Design
sergeychernyshev
32
1.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
131
19k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
570
Mobile First: as difficult as doing things right
swwweet
224
9.9k
How to train your dragon (web standard)
notwaldorf
96
6.2k
Building Adaptive Systems
keathley
43
2.7k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Documentation Writing (for coders)
carmenintech
73
5k
Building Applications with DynamoDB
mza
96
6.6k
Side Projects
sachag
455
43k
How STYLIGHT went responsive
nonsquared
100
5.8k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
284
13k
Transcript
postfix dereference పఈ߈ུ @mackee_w a.k.a macopy Gotanda.pm #16
୭ˠ • twitter: @mackee_w • GitHub: mackee • kuiperbelt/kuiperbelt :
WebSocketศར܅ • ࠷ۙPerl Hackers Hubʹςετͱ͔ͷهࣄΛॻ ͍ͨ
postfix dereference ͬͯԿ
postfix dereference $hashref->%* $arrayref->@*
postfix dereference $hashref->%* $arrayref->@*
postfix dereference $hashref->%* $arrayref->@*
ղઆ
postfix dereference %{$hashref} || $hashref->%*
postfix dereference @{$arrayref} || $arrayref->@*
postfix ɹ= έπʹͭ͘ dereference ɹ= σϦϑΝϨϯε ུ: postderef
֗ͷ ಡΊͳ͍ ͜Εศརʂ
ϝϦο τ
ϝϦοτ • ߦͬͯʙฦͬͯͬͯͳΒͳ͍ %{$aaa->{bbb}} $aaa->{bbb}->%* 1 2 3 4 5
6 7 1 2 3 4 5 6
σϝϦοτ
……ͳΜͰ ه߸૿ͪ͠Όͬͨͷʁ
͓٬༷ɺ ه߸૿͓ͯ͠Γ·ͤΜɺ ه߸ͷΈ߹ΘͤΛ૿ͨ͠ ͚ͩͳͷͰ͢……
Έ߹Θͤ……
୭͕ * ͚ͩͩͱݴͬͨ
hash slicing my $hashref = { k1 => "v1", k2
=> "v2", k3 => "v3" }; # ී௨ͷσϦϑΝϨϯε͔ΒͷϋογϡεϥΠε my ($v1, $v3) = @{$hashref}{qw/k1 k3/}; # postderefͰϋογϡεϥΠε my ($v1, $v3) = $hashref->@{qw/k1 k3/};
࣮࣭JSͷobject destructuringͰʁʁʁ ※ӈลʹॻ͔ͳ͍ͱ͍͚ͳ͍ͷͰҧ͍·͢ https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
·ͱΊ • ʢͱख͕֮͑Εʣศར • *͚ͩͰͳ͍ɻΉ͠ΖͦΕҎ֎͕ศར • v5.24͔Βexperimental֎Εͨɻ͑· ͢ʂʂʂʂ • ࠓճͷίʔυશ෦use
v5.24.0;ͯ͠·͢
http://perldoc.jp/docs/perl/5.24.0/perl5240delta.pod
postderef_qqͬͯͳʹ
postderef_qq my $hashref = { k1 => “v1", k2 =>
"v2", k3 => "v3" }; print "[$hashref->@{qw/k1 k3/}]\n"; # => [v1 v3]
ͳΔ΄Ͳͳʁ
csvΈ͍ͨʹग़ͨ͠Γ my @columns = qw/c1 c2 c3/; my $data =
[ { c1 => "aa", c2 => "bb", c3 => "cc" }, { c1 => "dd", c2 => "ee", c3 => "ff" }, { c1 => "gg", c2 => "hh", c3 => "ii" }, ]; $" = ","; print "@columns\n"; print "$_->@{@columns}\n" for @$data;
csvΈ͍ͨʹग़ͨ͠Γ $ perl postderef.pl c1,c2,c3 aa,bb,cc dd,ee,ff gg,hh,ii
Ͳ͏Αʁʁʁʁ
ײ • ϫϯϥΠφʔͱ͔Ͱศརͦ͏ • jqͷΘΓʹ͏ͱ͔ • ͱ͍͑·ͣv5.24ʹ্͛Δͱ͜Ζ͔Β……