Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Gotanda.pm #1
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Mihyaeru
June 11, 2014
Programming
210
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Gotanda.pm #1
Python使いから見たPerl @ Gotanda.pm #1
Mihyaeru
June 11, 2014
Transcript
31 slides
1ZUIPO͍͔Βݟͨ1FSM (PUBOEBQN !NJIZBFSV
ࣗݾհ w ϛώϟΤϧ!NJIZBFSV w 1ZUIPO 0CKFDUJWF$ śƂŠƃٙ 1FSM w
ΏͱΓ7JNNFS w ζϰΟζμʔઓಆһ
Α͘--ͬͯҰׅΓʹ͞ΕΔ͠ 1ZUIPOΘ͔Ε༨༟Ͱ͠ΐ
ͭ1FSM
sub say_hello { my $name = shift; ! print "Hello,
$name\n"; }
͋ΕͬʁҾʁ TIJGUͬͯͳΜͶΜ
sub sum_numbers { my $sum; for (@_) { $sum +=
$_; } ! return $sum; }
Μͬʁ
$_ @_
@_ͱ͔$_ͱ͔Ͳ͔͜ΒདྷͨΜ ͳΜ͡Ό͍͜ΓΌʔʂ
࠷ॳʹࢥͬͨෆຬ w มͳه߸ଟͯ͘ҙຯෆ໌ w ίϯςΩετʁʁʁ w ຖճNZͬͯॻ͘ͷ໘͍͘͞ w ਅِΣʜʜ w
ϦϑΝϨϯεपΓ͕Θ͔Γʹ͍͘ w ҾϦετͲ͜ʂʁ ʜଞʹ͔͚͋ͬͨͩͲΕͨ͆
มͳه߸ଟͯ͘ҙຯෆ໌ $_ @_ 1ZUIPOͰ͜ΜͳʹढจΊ͍ͨมग़ͯ͜ͳ͔ͬͨʂ $! $@ ͨͿΜʜ $. $/
͜Μ͖ͯ͢ͱʁʁʁ @a = (0, 1, 2) Ϧετ ίϯςΩετ 0, 1,
2 εΧϥʔ ίϯςΩετ 3 ཁૉ͕Γ͔ͨͬͨΒlen()ͱ͔໌ࣔతʹॻ͖͍ͨ ॴʹΑͬͯҙຯ͢Δͱ͜Ζ͕ҧ͏ʜʜͩͱʜʜ
NZࢯ w --ͬͯݴΘΕΔ͘Β͍ͩ͠ɺϥΠτʹॻ͖͍ͨ w 1ZUIPOͰम০ࢠͳ͠ͰϩʔΧϧม
ਅِΣʜʜ w ਅِΛද͢໌֬ͳ͕ͭͳ͍ w 5SVF 'BMTFཉ͍ͬ͢͠ w ίϯςΩετ૬·ͬͯѻ͍͕͍͠
ϦϑΝϨϯε w ࠷ॳɺ ͱ<>ಉͩ͡ͱࢥ͍ͬͯͨ w εΧϥʔมͳͷʹྻʂ w 1ZUIPOͰྻͱݴͬͨΒ͜Ε͚ͩ @a =
(0, 1, 2); $ref = \@a; $ref = [0, 1, 2]; a = [0, 1, 2]
ͳΜͰҾϦετͳ͍ͷ w !@Λड͚ͱΔ͚Ͳ͍ํࣗ༝͗͢ w 1ZUIPOͩͱؔͷσϑΥϧτΛઃఆͰ͖Δ͠ ΩʔϫʔυͰݺͿ͜ͱग़དྷΔʂ my ($a, $b) =
@_; my $a = shift; my %args = @_;
ͪͳΈʹ w σϑΥϧτΛͬͨݺͼग़͠ w ී௨ͷݺͼग़͠ w Ωʔϫʔυݺͼग़͠ def hello(name =
'mihyaeru'): print 'Hello, %s' % name ! hello() hello('dareka') hello(name = 'anata')
ෆຬΛ๊͖ͭͭ ϲ݄͕ܦա
࠷ॳʹࢥͬͨෆຬ w มͳه߸ଟͯ͘ҙຯෆ໌ w ίϯςΩετʁʁʁ w ຖճNZͬͯॻ͘ͷ໘͍͘͞ w ਅِΣʜʜ w
ϦϑΝϨϯεपΓ͕Θ͔Γʹ͍͘ w ҾϦετͲ͜ʂʁ
࠷ॳʹࢥͬͨෆຬࠓ w มͳه߸ଟͯ͘ҙຯෆ໌ w ίϯςΩετʁʁʁ w ຖճNZͬͯॻ͘ͷ໘͍͘͞ w ਅِΣʜʜ w
ϦϑΝϨϯεपΓ͕Θ͔Γʹ͍͘ w ҾϦετͲ͜ʂʁ ׳ΕΕා͘ͳ͍ʂ ׳ΕΕʢ͈́ ॻ͍ͨํ͕҆৺ײ͋Δ ਅِΣʜʜ Ҿʹ໊લͳ͘୯ͳΔϦετ ະͩʹͬ͘͠Γ͜ͳ͍
ෆຬ͔Γݴͬͯ ΞϨͳͷͰ
ؾʹೖ͍ͬͯΔͱ͜Ζ w ແ໊͕͍͍ؔ͢ w NBQͱ͔HSFQͷײ͕͖͡ w ϝιουݺͼग़࣌͠ͷୈҰҾʹTFMG͕ೖͬͯ͘Δ
ແ໊͕͍͍ؔ͢ w 1ZUIPOʹMBNCEBͱ͍͏ແ໊ؔΛ࡞Δه๏ΞϦ w ࣜΛ͔ͭ͠ೖΕΒΕͳ͍͔Βจͷॲཧμϝ hoge_call(sub { # do #
something # hoge }); def temp(): # do # something # hoge ! hoge_call(temp) 1FSM 1ZUIPO
NBQͱ͔HSFQ͕ྑ͍ײ͡ ҾΛح͚ͩʹߜΓࠐΜͰɺɺɺ ͨ͠ͷྻʹ͢Δɺɺɺ తͳॲཧ my @squared_odds = map { $_
* $_ } grep { $_ % 2 == 1 } @_;
1ZUIPOͩͱ [x * x for x in nums if x
% 2 == 1]
1ZUIPOͩͱ [x * x for x in nums if x
% 2 == 1] NBQʹ૬ HSFQʹ૬
Ϧετแදه [x * x for x in X if x
% 2 == 1] {x2 | x ∈ X, x % 2 = 1} ֶͷू߹ʹ͓͚Δแతදه͕ݩʹͳ͍ͬͯΔ
ϝιουͷTFMG 1ZUIPOΛኲኵͱͤͯۙ͞ײ͋Γ sub method { my ($self, $hoge) = @_;
} def method(self, hoge): pass
ಥ͚ͩͲ ͦΜͳ͜ΜͳͰ
·ͱΊ w 1FSM͍࢝Ίͯϲ݄ͷਓͷײ w ֖Λ͚͋ͯΈΔͱṖ͍ͱ͜Ζ͕ଟʑ w ͋Δఔ׳ΕͰͳΜͱ͔ͳΔʂ w 1FSMා͔͚ͬͨͲࠓͰ͖ͳͱ͜Ζ͋Δʂʂ
More Decks by Mihyaeru
See All by Mihyaeru
会計 freee バックエンドの今後 / freee backend api
mihyaeru21
8
27k
Railsで実装されている機能のマイクロサービスへの切り離し / split to microservices from rails
mihyaeru21
1
890
WebエンジニアのためのMySQLデータ構造基礎(再) / mysql data structure for web developer 2
mihyaeru21
0
340
WebエンジニアのためのMySQLデータ構造基礎 / mysql data structure for web developer
mihyaeru21
1
740
WebエンジニアのためのMySQL入門 / learning mysql for web developer
mihyaeru21
7
2.7k
入門ReactiveX / about ReactiveX
mihyaeru21
3
530
RxSwiftと愉快な仲間たち / RxSwift with Units
mihyaeru21
4
2.9k
RxSwiftでTwitterの ライブラリを作ってる話 / RxTwift
mihyaeru21
4
810
CrystalでTwitter botを作ってみた / Create a Twitter bot in Crystal
mihyaeru21
0
1.4k
Other Decks in Programming
See All in Programming
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
350
Kotlin Fest 2026: Kotlin コンパイラに Contribute してみよう! - Kotlin/Wasm で深い再帰を書けるようにした話
ternbusty
1
280
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
190
なぜ私たちは「現時点では」KMPの導入を見送ったのか
chigichan24
1
290
疎結合とは何か?ソフトウェア設計における結合バランスについて考える #phpcon_niigata
kajitack
1
280
Web3Dライブラリを作ってVue Custom Rendererの仕組みを理解しよう / lets learn vue custom renderer by making 3d library
drumath2237
1
140
Crash Auto Pipelines
veronikapj
1
420
AI-Powered Domain-Driven Design
ziobrando
0
460
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
340
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
240
将来の標準フォーマッター?ktfmtを深堀る
t45k
0
200
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
180
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
46
8.4k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
680
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
Music & Morning Musume
bryan
48
7.5k
How Software Deployment tools have changed in the past 20 years
geshan
3
35k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.9k
Navigating Team Friction
lara
192
16k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
610
So, you think you're a good person
axbom
PRO
2
2.3k
The Spectacular Lies of Maps
axbom
PRO
1
1.1k