{"published":"2007-11-08 01:37:03","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsrkzhr.hatenadiary.org%2Fentry%2F20071108%2F1194539823\" title=\"grep\u3068map\u306e\u4f7f\u3044\u5206\u3051 - \u534a\u5f845\u30e1\u30fc\u30c8\u30eb\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","version":"1.0","url":"https://srkzhr.hatenadiary.org/entry/20071108/1194539823","provider_name":"Hatena Blog","blog_title":"\u534a\u5f845\u30e1\u30fc\u30c8\u30eb","provider_url":"https://hatena.blog","image_url":null,"height":"190","author_url":"https://blog.hatena.ne.jp/srkzhr/","width":"100%","author_name":"srkzhr","title":"grep\u3068map\u306e\u4f7f\u3044\u5206\u3051","blog_url":"https://srkzhr.hatenadiary.org/","categories":["Perl"],"type":"rich","description":"\u300cEffective Perl\u300d\u3067grep\u3068map\u306e\u4f7f\u3044\u5206\u3051\u306b\u3064\u3044\u3066\u5b66\u3093\u3060\u306e\u3067\u7c21\u5358\u306a\u7e8f\u3081\u3067\u3059\u3002 #!/usr/bin/perl use strict; use warnings; chomp (my @list = `ls *.txt`); # \u5143\u306e\u8981\u7d20\u304b\u3089\u62bd\u51fa\u3057\u305f\u3082\u306e\u3060\u3051\u306e\u30ea\u30b9\u30c8 my @grepped = grep { /(.*)\\.txt$/ } @list; print join \",\", @grepped, \"\\n\"; # \u5143\u306e\u8981\u7d20\u306e\u30b3\u30d4\u30fc\u304b\u3089\u52a0\u5de5\u3057\u305f\u5225\u306e\u30ea\u30b9\u30c8 my @mapped = map { /(.*)\\.txt$/ } @list; print join \",\", @map\u2026"}