[EMAIL PROTECTED] wrote:
i am trying to write a simple program that splits text, but when I output
the results I end up with SCALAR(0x15d4ee8) all over the place.

That is what happens when you print a reference to a scalar.

$ perl -le'
$x = 12345;
$y = \$x;
$$z = $x;
print for $y, $z;
'
SCALAR(0x814e3dc)
SCALAR(0x81401c8)


perldoc perlreftut perldoc perlref


Is there
any way to stop this? also, it appears in the output, but oddly if i write
the output to a file, import it, and try to s/ it out, it remains there.
I know its a bit messy and I will clarify my variables later, but this
should work shouldnt it? Thanks ~BJ

code:

You should really start your programs with these two lines (to help you find mistakes):


use warnings;
use strict;


open(IN,"a.html");

You should *ALWAYS* verify that the file opened correctly.

open IN, '<', 'a.html' or die "Cannot open 'a.html' $!";


@in=<IN>;
close IN;
open(OUT,">references.txt");

You should *ALWAYS* verify that the file opened correctly.

open OUT, '>', 'references.txt' or die "Cannot open 'references.txt' $!";


$big=join(\n,@in);
$a='<h3>References</h3>';
@first=split/$a/,$big;
$second=$first[1];
if($second=~/<h3>/)[EMAIL PROTECTED]/<h3>/,$second;}
[EMAIL PROTECTED]/<hr>/,$second;}
$forth=$third[0];
$b='</p>';
@refs=split/$b/,$forth;
$,="\n";
$v='&ndash';
print @refs;

I don't see any scalar references in your code that could cause your problem. Is that your entire program?


You might also think about adding whitespace and indenting to make your code more readable.

perldoc perlstyle



John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to