Replace backslash with forward slash in Perl
I'm new to perl and i am having a serious problem importing a file into a database. I need a way to replace the backslash with the forward slash.Is it possible buy writing a user defined function? Can anyone please help me... Thanks in advance! :rolleyes:
Re: Replace backslash with forward slash in Perl
Try this :
Code:
open ULFILE, ">$upload_dir/$filename";
binmode ULFILE;
while ( <$upload_filehandle> )
{
$_ =~ s/\\//g;
print ULFILE;
}
close ULFILE;
Replace variables accordingly...
Re: Replace backslash with forward slash in Perl
Ok, thanks, i will try it out... But any other code or script? Just in case this doesn't work, Thanks though... Will try your code and get back about it... :rolleyes: :biggrin:
Re: Replace backslash with forward slash in Perl
Well, try this out :
Code:
find -name "*.html" -type f | while read file
do
awk '{ gsub( /\\/, "/" ); print }' $file > $file.$$
mv $file.$$ $file
done
Hope this works... :thumbup1: