in reply to Script being caught up, somewhere. Causing infinite loop.
Besides using for or foreach for the outer loop, you can replace
open(FILE,"/home/kyleyankan/public_html/content/$_"); @content = <FILE>; close(FILE); while (@content) { $stuff .= $_; }
with
open(FILE,"/home/kyleyankan/public_html/content/$_"); my $stuff = join'', <FILE>;
Or if your comfortable with the concept
my $stuff = do{ local *ARGV, $/; @ARGV = "/home/kyleyankan/public_html/content/$_"; <>; };
Also, you should really be checking the return code from open. eg
open FILE, "< path/$_" or warn "Error on $_: $!;
|
|---|