On Fri, Jul 3, 2015 at 11:10 AM, Nagy Tamas (TVI-GmbH)
<tamas.n...@tvi-gmbh.de> wrote:
> Hi,

Hello,

> My code:

It's evident that this is not actually your code, let alone the full code...

> Use strict;
>
> Use warnings;

Those must be 'use', not 'Use'. Obviously you aren't actually using
them or at least this isn't actually the code. :P

> my $j = 0;
>
> my $doread = 0;
>
> my ($buf, $data, $n);
>
> $n = read FILE, $data, 1;
>
> $buf = $data;
>
> while($n != 0) {
>
>
>
> $doread = 0;
>
>
>
> # there has to be a begin tag before the end tag
>
> # so we can check for begin tag first
>
>
>
> if($begintagfound == 0) {

If you actually were using warnings and strict you'd be getting an
error here for the undefined variable $begintagfound.

>     if($buf eq chr hex $xhtmlbegin[$j + 1]) {
>
>         $doread = 1;
>
>         $j = $j + 1;
>
>     } else {
>
>         if($j == 0) {...  line 125

There are not 125 lines in your entire message.

>
> …
>
>
>
> Says use of uninitialized value $j in numeric eq == at line 125
>
> Does anyone has any idea why does it tell $j as uninitialized?
>
>
>
> I initialized it at the first line to 0.

We can't have any idea what's wrong because we don't have the actual
code. If you want actual help with the code then paste a full example
that demonstrates the problem. I suspect the issue here is lexical
scope combined with the lack of strict, but it could be any number of
things.

It also appears as though you're trying to write a square HTML parser
of sorts. I'd suggest using one of the CPAN modules that already exist
for this purpose. Don't roll your own unless you really want square
wheels.

Feel welcome to post a real example if you want some real help with
the real warning.

Regards,


-- 
Brandon McCaig <bamcc...@gmail.com> <bamcc...@castopulence.org>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bambams.ca/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to