Lee Hosty said:
> what I'm doing is sucking in a webpage using LWP off a site thats run on a
> mac ...
>> I dump this to a file ... then I open this file and want to seperate the
> lines in it ... the @array seems to read it in as one element ... so
> chomp() wont work and the only way I can think of to seperate it is by
> splitting it up using the newline element ... \n doesnt work, nor \r\n ...
> I've tried a few combinations of \f \n and \r but still no joy ...
I can't remember the newline sep variable (see man perlvar), but a quick
way to do it would be:
$blob = join ('', <HANDLE>);
@lines = split (/[\r\n]+/, $blob);
that'll handle any platform's line-endings and split it into lines.
However multiple blank lines will be ignored with this method, c'est la
To specifically handle Mac line endings, use this:
@lines = split (/\r/, $blob);
Macs use \r, windoze uses \r\n, and UNIX is \n.
BTW regarding RedHat's printfilter stuff -- (a) it shouldn't be in the
/var/spool/lpd directory anyway for security reasons and (b) it should
DEFINITELY not be a shell script of all things. That's definitely the
kind of thing that they should have done an rpm on, i.e. come up with a
new, well-designed, well-implemented utility. In fact, I'd seen two
half-built implementations of the same thing in C by that point, so they
should just have adopted one of those!!
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!