Kevin Pfeiffer wrote: > I'm looking at HTML::TokeParser. It expects a scalar with a filename or a > reference to a scalar containing the data to parse. > > This works fine: > > my $html; > if (@ARGV) { # get filename for TokeParser > $html = shift; > } else { > my @html = <>;
Where is the diamond operator here supposed to be filled from? I must admit, I am not terribly familiar with it, since I don't use it. I would recommend that you l.likewise avoid, unless you are certain that it will actuall get loaded. Is there a problem with using the more explicit, and readable <STDIN>? From your description of the desired usage, in conjunction with a pipe, this should render some a little less mysterious, at least. > > $html = \(join '', @html); # pass scalar ref to module > } > > Unless there is no input at all; then the script hangs. So I tried this: > > my $html; > if (@ARGV) { # get filename for TokeParser > $html = shift; > } elsif (my @html = <>) { > $html = \(join '', @html); # pass scalar ref to module > } else { > die "Usage '$0 [filename]' or 'datasource | $0'\n"; > } > > ...with the same result. > > -K I am still a little unclear on what you are trying to do. If you have a program that will output html, the code should work, possibly even with the default diamond operator, certainly with <STDIN>. What is the context in which you are testing it? Hmmm. Are you sure the hang is not simply the script waiting for the next line of input? On my ActiveState installation on Win 32, I signal end of input with CTL-Z [shows as ^Z on my console.]. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]