[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-AnyPerl] Mac to linux perl problem



On Sun, Mar 12, 2000 at 09:50:26PM +0000, Richard Allen wrote:
> Anyone know why I get ^H (escape character?) inserted into the output 
> of this script infront of the 0\1 replacement on a linux machine, it 
> works a treat under macperl?
> 
> ---------------------
> #!/usr/bin/perl
> print "This script takes a CSV file and normalizes the date to 
> 03/12/87. \nWhat file do you want to convert? ";
> chomp ($filename = <STDIN>);
> open (THATFILE, "$filename") || die "cannot open $filename: $!";
> open (OTHERFILE, ">output.xls") || die "cannot open output.xls";
> while (<THATFILE>) {
> 	if (s/\b(\d)(\d\d)(19)(\d\d)/\b0\1\/\2\/\4,/g) {
                                     ^^
> 	}	else {
> 	(s/\b(\d\d)(\d\d)(19)(\d\d)/\b\1\/\2\/\4/g)
                                    ^^
> }
> print OTHERFILE $_;
> ---------------------


\b is the escape character for backspace.
(Except in regexes, where it's a word-boundary assertion.)
[Except in character classes, where it's a backspace again.]


Ronald

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org