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

Re: [MacPerl] Is this a bug?



rpyle@tiac.net (Robert Pyle) writes:

}I've been reading Randal Schwartz's Unix Review column no. 12, which is
}about "here documents".
}
}Here's a short script (saved in file t.pl):
}
}#! perl -w
}        print <<HELLO;
}        hi
}        HELLO
}
}Seems like this should be equivalent to
}
}#! perl -w
}        print "hi\n";
}
}but when I try to run it, MacPerl 5.1.3r2 tells me
}
}# Can't find string terminator "HELLO" anywhere before EOF.
}File 'develop:Mac_Perl:mycode:t.pl'; Line 2
}
}Is there some (good) reason this doesn't work on a Mac?

Can someone please tell me why people automatically think there is
something wrong with MacPerl rather than with their script?

The reason it doesn't work is that HELLO must be *flush left*, no whitespace,
or Perl (any Perl, including the Perl Randall Schwartz uses on whatever he
uses these days) won't find it.  This works:

#!perl

print <<HELLO;
hi
HELLO

}
}Thanks for any insight.
}
}Bob Pyle, Cambridge, MA, USA


--------
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693
Greenbelt, MD 20770
schinder@pjstoaster.pg.md.us