in reply to Re^3: Read webpage into a variable
in thread Read webpage into a variable
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.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); }
|
|---|