>Or did you mean, how would you go through a variable's content 
>line-by-line?  For that, try something like this:
>
>my @lines = split /(\n)/, $data;
>foreach (@lines) { do_something() if /pattern/; }
>$data = join '', @lines;
>
>Hope that helps.
>
>James

That's exactly what I meant, sorry didn't realise the email could be read 2
different ways ;)

So split the var into an array. That makes sense. The only issue I will have
with that is the array will need to be remade at the end of each loop as the
number of line breaks will change at the the end of each process

here's what I'm actually trying to do.
    # get anon hash from keywords array
    for my $href ( @Keywords ) {
    
        #get keyword from that hash
        for $kw ( keys %$href ) {

            # see if keyword is in content.
            if ($content =~ /\b($kw)\b/g) {
                
                # do replacement patterns on content
                 
            }
        }
    }

At the bit where it says # do replacement patterns on content I will be looking
through $content and doing a substitution

$content =~ s/($kw)/\n$1\n/;

so this will actually be adding extra newlines to the content. But I do need to
read it a line at a time so that I can check the lines don't start with the
letters qz (Don't ask... very long story ;)

So my fear is that I will need to recreate that array after each pass because
the number of newlines will be growing. 

I thought that would be terribly inefficient, I'm used to using languages that
choke at the mere suggestion of doing work. I like Perl, it doesn't do that.

If you have any suggestions I would be most grateful to hear them.

Thanks

Angie

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

Reply via email to