Re: newlines and no newlines

[email protected] ("Cortland D. Starrett")
Newsgroups perl.recdescent
Message-ID <[email protected]>
Yes, it works for me too, but only after some localization.

sub loadfile($)
{
  local(*INPUT, $/);
  open (INPUT, $_[0]) or die "Could not open file $_[0].\n";
  $contents = <INPUT>;
  return $contents;
}

Thanks for the help!

Cort.

On Tue, 27 Nov 2001, Damian Conway wrote:

> This works fine as far as I can tell:
> 

[trim]

> 
> Of course, $tree doesn't actually have the parse tree in it, since the
> autoaction means the last item of each rule is a print statement, which
> returns 1. So the entire parse returns 1. :-(
> 
> Perhaps you wanted:
> 
>         $::RD_AUTOACTION = q{ print "$item[0]\n"; [@item[1..$#item]] };
> 
> ???
> 
> Damian
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.