in reply to Re^2: Read webpage into a variable
in thread Read webpage into a variable

So maybe consider investigating how it "didn't work".

Replies are listed 'Best First'.
Re^4: Read webpage into a variable
by liverpaul (Acolyte) on Nov 21, 2011 at 09:57 UTC
    By saying it "didn't work" I mean it doesn't respond. I don't get any messages that give me a hint (I'm using use warnings; and use diagnostics;). Update, solution:
    The problem was with my function.
    sub extract_html_to_temp_file #url, path&file { my $temp_var = ""; my $url = $_[0]; chomp($url); my $filename = $_[1]; chomp($filename); open(OUTPUT_FILE,">$filename") or die "COULDN'T OPEN FILE!!!, $!\n +"; $_ = get($url);#read HTML file contents into variable $temp_var = $_; print OUTPUT_FILE $temp_var; close(OUTPUT_FILE); }
    After the line $temp_var = $_; I had several lines of code that stripped the string of things I didn't want, eg. $temp_var = s/ / /g; etc. I have no idea why this would be a problem, but once I removed these lines the function worked.
    The fact that my function worked for webpages with an extension and not for webpages without an extension caused me to look for the wrong kind of solution.
    Thanks for the reply :-)