use LWP::Simple; foreach $ID (@ID) { $content=" "; $url="http:://...docid=$ID"; $content=get($url); # subsequently I extract information from the string # $content, which only serves as a contemporary storage Open FILE, ">> C:/perl/output.txt"; Print FILE $content; # actually it's all the other variables whose values I # want to save }