http://qs321.pair.com?node_id=1189434

mdkoehn has asked for the wisdom of the Perl Monks concerning the following question:

The following script works, reading from the DATA section:

#! /usr/bin/perl -C255 use strict; use warnings; use LWP::Simple; use Encode 'decode'; use URL::Encode ':all'; use feature 'unicode_strings'; use utf8; use open ':encoding(UTF-8)'; open INFIL, "<:encoding(UTF-8)", "temp.txt" or die; #This line generat +es a warning. #while (<INFIL>) { while (<DATA>) { chomp; my $title = $_; $title =~ s/\/.*//; $title =~ s/\[by.*//; print "Title Searched: $title\n"; $title = url_encode_utf8($title); my $html = getprint("https://clio.columbia.edu/catalog?q=$title&se +arch_field=title_starts_with&f%5B-format%5D%5B%5D=Online&commit=Searc +h") or die; } exit; __DATA__ How to conduct your own survey / Priscilla Salant and Don A. Dillman.

But, if I change it to read from a file, like so:

#! /usr/bin/perl -C255 use strict; use warnings; use LWP::Simple; use Encode 'decode'; use URL::Encode ':all'; use feature 'unicode_strings'; use utf8; use open ':encoding(UTF-8)'; open INFIL, "<:encoding(UTF-8)", "temp.txt" or die; #while (<DATA>) { ###CHANGE HERE### while (<INFIL>) { chomp; my $title = $_; $title =~ s/\/.*//; $title =~ s/\[by.*//; print "Title Searched: $title\n"; $title = url_encode_utf8($title); my $html = getprint("https://clio.columbia.edu/catalog?q=$title&se +arch_field=title_starts_with&f%5B-format%5D%5B%5D=Online&commit=Searc +h") or die; } exit; __DATA__ How to conduct your own survey / Priscilla Salant and Don A. Dillman.

I get the error: 501 Protocol scheme 'https' is not supported (LWP::Protocol::https not installed) <URL:https://clio.columbia.edu/catalog?q=How+to+conduct+your+own+survey+&search_field=title_starts_with&f%5B-format%5D%5B%5D=Online&commit=Search>

The input file contains only a single line, the same as the DATA section.

I've tried this on both Strawberry Perl 5.24.1 and Cygwin Perl 5.22.3

All feedback appreciated.

Thanks, Michael