<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>unau</author_name>
  <author_url>https://blog.hatena.ne.jp/unau/</author_url>
  <blog_title>昨日知ったこと</blog_title>
  <blog_url>https://unau.hatenadiary.org/</blog_url>
  <categories>
    <anon>Perl</anon>
  </categories>
  <description>変数をループで回しながら、特定の条件にマッチしたところでループを抜け出し、条件にあった変数値を得たい、というときがある。そんなとき、次のようなコードを書いていた。 use strict; use warnings; my @candidates = qw/this is a test/; my $code; PREF: foreach $code (@candidates) { last PREF if length($code) == 1; } print &quot;$code\n&quot;; 実行結果は [takeyuki@sunya ~]$ perl a.pl Use of uninitialized …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Funau.hatenadiary.org%2Fentry%2F20100227%2F1267276500&quot; title=&quot;foreach を last で抜けるとループ変数の値は保存されない - 昨日知ったこと&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2010-02-27 22:15:00</published>
  <title>foreach を last で抜けるとループ変数の値は保存されない</title>
  <type>rich</type>
  <url>https://unau.hatenadiary.org/entry/20100227/1267276500</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
