{"id":3211,"date":"2023-11-09T19:21:53","date_gmt":"2023-11-10T04:21:53","guid":{"rendered":"https:\/\/crm270s.wordpress.com\/?p=3211"},"modified":"2023-11-09T19:21:53","modified_gmt":"2023-11-10T04:21:53","slug":"firefox_website_02-pl","status":"publish","type":"post","link":"https:\/\/crm270s.mycpamytax.com\/?p=3211","title":{"rendered":"firefox_website_02.pl"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>use strict;\nuse warnings;\n\n# Initialize variables to store extracted URLs\nmy @google_maps_urls;\n\n# Process each HTML file (1.html to 25.html)\nfor my $file_number (1..25) {\n    my $input_file = \"${file_number}.html\";\n\n    # Open the current input file for reading\n    open my $input_fh, '&lt;', $input_file or warn \"Cannot open input file '$input_file': $!\";\n\n    my $previous_line = '';\n    my $current_line = '';\n    my $extracting = 0;\n\n    # Read each line and look for URLs\n    while (my $line = &lt;$input_fh&gt;) {\n        chomp $line;\n\n        # Check if the current line contains \"+82\"\n        if ($current_line =~ \/\\+82\/) {\n            # Check if the next line contains \"Website\"\n            if ($line =~ \/Website\/) {\n                $extracting = 1;\n                push @google_maps_urls, \"$input_file, $current_line\";\n            }\n        }\n\n        # Continue extracting 3 more lines if we're in an extraction state\n        if ($extracting) {\n            push @google_maps_urls, \"$input_file, $line\";\n            if (@google_maps_urls % 4 == 0) {\n                $extracting = 0;\n            }\n        }\n\n        # Store the current line for the next iteration\n        $previous_line = $current_line;\n        $current_line = $line;\n    }\n\n    # Close the current input file\n    close $input_fh;\n}\n\n# Save the extracted URLs to a file\nmy $output_file = 'firefox_website_02.txt';\nopen my $output_fh, '&gt;', $output_file or die \"Cannot open output file '$output_file': $!\";\n\nforeach my $url (@google_maps_urls) {\n    print $output_fh \"$url\\n\";\n}\n\n# Close the output file\nclose $output_fh;\n\nprint \"Extraction complete. Extracted 4 lines (including +82 and Website) are saved in '$output_file'\\n\";\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[26],"tags":[],"class_list":["post-3211","post","type-post","status-publish","format-standard","hentry","category-codes"],"_links":{"self":[{"href":"https:\/\/crm270s.mycpamytax.com\/index.php?rest_route=\/wp\/v2\/posts\/3211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/crm270s.mycpamytax.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/crm270s.mycpamytax.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/crm270s.mycpamytax.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/crm270s.mycpamytax.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3211"}],"version-history":[{"count":0,"href":"https:\/\/crm270s.mycpamytax.com\/index.php?rest_route=\/wp\/v2\/posts\/3211\/revisions"}],"wp:attachment":[{"href":"https:\/\/crm270s.mycpamytax.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/crm270s.mycpamytax.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/crm270s.mycpamytax.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}