Ramprasad wrote:
>
> This was not cut pasted from my actual code. I cannot paste my 250
> line script here so I just wrote a hapazard relevant replica of what
> I did.

Fair enough! An even worse problem is where people's company standards
prohibit decent coding, but I always bear in mind that what's posted
isn't the actual code :)

> Thanks anyway, I do use strict ( not warnings , irritates me when
> perl tells me use of unitialized var when I meants it to be so  )

At the very least you should have

  use warnings;
  no warnings 'uninitialized';

But Perl's smart enough to ignore sensible use of uninitialised variables
so it's far better to explcitly set up variables that otherwise throw up
warnings. For instance

  use warnings;
  my $file;
  push @{$file}, $_ while <>;

works fine. As does

  use warnings;
  my $string;
  $string .= $_ foreach qw/A B C D/;

and

  my $i;
  while (<>) {
    chomp;
    printf "%4d: %s\n", ++$i, $_;
  }

In general, Perl's principle is

  "I've had nothing yet," Alice replied in an offended tone, "so I can't take more."
  "You mean you can't take less," said the Hatter: "it's very easy to take more than 
nothing."

                              Alice's Adventures in Wonderland - Lewis Carroll


> And in my real script I have @array as something more meaningful
> But doesnt work anyway.
>
> I just have changed the logic. I am using /mi always and put only
> regex in the array and am looping thru the array.

I'm still not sure how, or why. You need to post a sample that is more
representative of your code. Have you tried my example and seen that
it works? How does it differ from what you have?

Cheers,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to