One thing is that you are doing a numeric compare(ie == vs eq) Perl tries it
best to come up with a valid response. Since you are doing the compare, why
not just do the re as
$doc =~ s/^\s{6}$/111111/;
which says if you have six whitespace then change to 1's or
whatever.
Wags ;)
-----Original Message-----
From: Mark Martin [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 08, 2001 10:01
To: [EMAIL PROTECTED]
Subject: Substitution Problem
Hi,
I'm taking in a csv file and splitting it. One of the fields(doc) could
possibly have six spaces which will disrupt the program later on so I need
to substitute in dummy values. $doc == " " finds the "empty" fields
okay but the substitution doesn't work. Clear as Mud?? Any ideas?
open (FILEHANDLE,$file);
while (<FILEHANDLE>){
chomp;
($type,$doc,$narrative,$amount,$bdate,$branch) =
split(/,/);
if ($doc == " "){
doc =~ s/ /111111/;
_____________________________________________
Mark Martin
Computer Centre
National University of Ireland Maynooth
Tel: (01)708 4716/3830
Fax: (01)628 6249