⎗ ✓ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60use strict; use warnings; use utf8; binmode STDOUT, ":utf8"; use feature qw/say/; use Encode 'decode'; use HTML::Entities; my @ta_url =('https://w.atwiki.jp/swsw/pages/12.html','https://w.atwiki.jp/swsw/pages/15.html'); for my $ta_url (@ta_url){ my $syscommand = qx{curl -s $ta_url}; $ta_url = ""; my $body = decode('UTF-8',$syscommand); undef($syscommand); #________________________________________________ my $text = decode_entities($body); $text =~ s/\<br\s\/\>/\n/g; my @text_array = split(/\n/, $text); my $flag1 = 0; my $flag2 = 0; my $text2 = "```perl\n"; my $length = @text_array; my $count = 0; foreach(@text_array) { my $row = $_; if ($row =~ /noupdate_text/){ $flag1 = 1; } unless ($flag1 == 1){ next; } if ($row =~ /atwiki-lastmodify/){ $flag2 = 1; } if ( $flag2 == 1){ $text2 .= "```\n"; last; } if ($count == 0){ $count = 1; next; } $text2 .= "$row\n"; $count ++; } say $text2; }
Warning LINK You are about to visit a link which has been flagged with the above content warnings. Do you wish to continue? Continue Cancel