hi to all,

another silly question about a pattern matching which should work but it doesn't.

I have a list af string similar to this one:

        parola|n.c.,0,fem,sg,0|parola

and I need to select all the chars before the pipe and put them in a variable.

That substitution does'n work:

        #!/usr/bin/perl -w
        use strict;
        my(%gen, %act, %record, $tex, $char, @parola, $zut);
        while(<>)
                {
                $tex =~ s/^([^|]+).*/$1/o;
                print STDOUT "$i errore sulla linea: $_\n" if !$tex;
                }

The error message is (for example):

Use of uninitialized value in substitution (s///) at ./contalettere.pl line 6, <> line 10.

I suppose the rror is in the expression: [^|].

Someone can help me?

Thanks a lot,

alladr

|^|_|^|_|^|                              |^|_|^|_|^|    
 |            |                                 |            |
 |            |                                 |            |
 |            |*\_/*\_/*\_/*\_/*\_/* |            |
 |                                                           |
 |                                                           |
 |                                                           |
 |         http://www.e-allora.net        |
 |                                                           |
 |                                                           |
**************************************


--
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