Re: [perl-python] 20050126 find replace strings in file

2005-01-26 Thread Eric Schwartz
To follow up on Jurgen Exner's critique, I present Xah Lee's version, and then my rewritten version. "Xah Lee" <[EMAIL PROTECTED]> writes: > if (scalar @ARGV != 4) {die "Wrong arg! Unix BNF: $0 > \n"} > $stext=$ARGV[0]; > $rtext=$ARGV[1]; > $infile = $ARGV[2]; > $outfile = $ARGV[3]; > open(F1,

Re: [perl-python] 20050126 find replace strings in file

2005-01-26 Thread Jürgen Exner
Xah Lee wrote: [...] > In perl, similar code can be achieved. > the following code illustrates. > > if (scalar @ARGV != 4) Why scalar()? The comparison already creates a scalar context, no need to enforce it twice. > {die "Wrong arg! Unix BNF: $0 > \n"} > $stext=$ARGV[0]; > $rtext=$ARGV[1];

Re: [perl-python] 20050126 find replace strings in file

2005-01-26 Thread Haibao Tang
OK. But please don't die throwing that string, or this post will lose its educational purpose as it was meant to be. -- http://mail.python.org/mailman/listinfo/python-list