Hi All, I am a perl novice and am having some trouble with formatting a web file to put into a hash. I have the following code:
#!/usr/bin/perl -w use LWP::Simple; #use strict; sub sws { my $file = shift; while (!eof(FH)) { $line = <FH>; push @temp, $line; } foreach $line(@temp) { $line =~ s/^\s*(.*?)\s*$/$1/; #print "$line\n"; } } my $url = 'http://domain.com/path/to/file'; my $content = get $url; die "Couldn't get $url" unless defined $content; open (FH, ">localfile") || die "Cannot open the first file... $!\n"; print FH $content; close (FH); my $file = "localfile"; open (FH, "<$file") || die "Cannot open the second file... $! \n"; sws(*$file); close(FH); exit 0; I do want to use a sub so I can use it for other web files. The above code does write the content of the file to the localfile but the sub does not write the stripping of whitespace. I use the print "$line \n"; to test and it does print the file content into the proper format of stripped whitespace to STDOUT. I'd like to use strict as well but I have a undeclaired problem as well. The last step will be for me to put the localfile content into a hash split on a blank space. As you can see I am far from proficient in perl. Any suggestions to get me on the correct track would be greatly appreciated. Thanks in advance, Herb -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/