use URI::Escape qw( uri_escape ); my $escaped_file = $nfile; # Convert the file name to a URL. $escaped_file = uri_escape($nfile); # Escape the URL for use in an HTML attribute. #uri_escape already removes & and ". #$escaped_file =~ s/&/&/g; #$escaped_file =~ s/"/"/g; print FIL "\n";