I think \r is the newline sep for a mac. The variable you want to play with
is $/, if you do
$/ = "\r";
open(FILE, "filename");
@array = <FILE>;
then perl will split the contents of the file on occurences of \r.
By the way if the page is big you should use
while (<FILE>)
{
do some stuff with $_
}
instead of using @array as @array will read the whole thing in before doing
anything else, the same goes for for loops.
Also, why do you download the page, dump it in a file and then open that
file? Why not download the page and just do
@array = split("\r", $the_web_page);
Fergal
At 17:14 11/02/00 +0000, Lee Hosty wrote:
>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 ...
>>At 16:44 11/02/00 +0000, Donncha O Caoimh wrote:
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!