Perl's regex handling. That's the one I miss in whatever other language I program in.
To be able to match AND get the matched substrings out in one line, makes this really succinct.
E.g. in ruby this could be
puts $1 if /(\d+)/ =~ 'test 123' # perl-like
if m = /(\d+)/.match('test 123') then puts m[1] end # perl-less
Perl's regexes do more things perhaps, but this is a relatively common thing, I believe.Matching & getting in most languages typically devolves into matching a regexp to a string, getting a MatchResult object, and then getting/iterating/checking/... on it.
if ($hour >= 12) {
if ($min == 42) {
doSomething();
}
}
Whereas in Python, Ruby even though it's only a tiny extra step, but that symantic distance in one's head when parsing out and naming the parts of a regex on the same is a convenience that when you get used to it, you really miss it. m = /(\d\d):(\d\d):(\d\d)/.match( someTimeString )
hour = m[0]
min = m[1]
sec = m[2]
if hour >= ... hour, min, sec = /(\d\d):(\d\d):(\d\d)/.match('10:11:12').captures
or hour, min, sec = re.compile(r'(\d\d):(\d\d):(\d\d)').match('10:11:12').groups()
ruby & python will explode if there is no match rather than fail silently but I'm not convinced the difference is huge.