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
360
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
7.8k
tanukistack ライブコーディング / tanukistack live-coding
mackee
0
100
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
640
perl for shell, awk and sed programmers
mackee
2
2.2k
今更GoのWebフレームワークを作ろうとしているワケ / Why am I trying to create a Go web framework now?
mackee
1
610
database/sqlでNullを扱う歴史とsql.Null[T]の登場 / sql.Null[T] history
mackee
0
500
マイクロサービス化を利用した Goへの移行事例
mackee
0
630
PerlでつくるフルスクラッチWebAuthn/パスキー認証 / Demonstration of full-scratch WebAuthn/Passkey Authentication written in Perl
mackee
3
4.5k
SRE定例やその辺の取り組みをアプリケーションエンジニア目線で語る / "Observe" about SRE Meeting by Application Engineer
mackee
0
1.9k
Other Decks in Programming
See All in Programming
deno-redisの紹介とJSRパッケージの運用について (toranoana.deno #21)
uki00a
0
130
iOSアプリ開発で 関数型プログラミングを実現する The Composable Architectureの紹介
yimajo
2
210
関数型まつり2025登壇資料「関数プログラミングと再帰」
taisontsukada
2
840
Bytecode Manipulation 으로 생산성 높이기
bigstark
2
360
Go Modules: From Basics to Beyond / Go Modulesの基本とその先へ
kuro_kurorrr
0
120
関数型まつりレポート for JuliaTokai #22
antimon2
0
130
コード書くの好きな人向けAIコーディング活用tips #orestudy
77web
3
330
ASP.NETアプリケーションのモダナイズ インフラ編
tomokusaba
1
390
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
1
200
XSLTで作るBrainfuck処理系
makki_d
0
210
AIネイティブなプロダクトをGolangで挑む取り組み
nmatsumoto4
0
120
来たるべき 8.0 に備えて React 19 新機能と React Router 固有機能の取捨選択とすり合わせを考える
oukayuka
2
830
Featured
See All Featured
Visualization
eitanlees
146
16k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.5k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.8k
Rebuilding a faster, lazier Slack
samanthasiow
81
9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Practical Orchestrator
shlominoach
188
11k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
Unsuck your backbone
ammeep
671
58k
Gamification - CAS2011
davidbonilla
81
5.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
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ʹ্͛Δͱ͜Ζ͔Β……