Without being able to debug the code, I can only take an educated guess. You are declaring $string on the same line on which you are performing your pattern match.
If the pattern does not produce a result, $string will remain ( or become ) uninitialized. This would produce the exact error that you are seeing. As your code is written, if a line has even a single character, it will be pushed into the words array and if it is in there, it must match the double pipe regex or you'll get that error. Try printing $defln prior to the regex and see if the line causing your script to blow up is matching your regex. Good Luck, Bryan -----Original Message----- From: Mehta, Perdeep [mailto:[EMAIL PROTECTED]] Sent: Monday, September 30, 2002 5:09 PM To: [EMAIL PROTECTED] Subject: RE: [Perl-unix-users] Perl help No! this did not change the behavior. perdeep -----Original Message----- From: Trevor Joerges [mailto:[EMAIL PROTECTED]] Sent: Monday, September 30, 2002 3:55 PM To: Mehta, Perdeep; [EMAIL PROTECTED] Subject: Re: [Perl-unix-users] Perl help Your printing to a filehandle OUT. What do you need the greater than symbol before the $string for? If you are trying to print a literal greater than string you will need to escape it "\> $string\n" otherwise just print "$string\n". Hope this helps. Trevor Joerges SendMIME Software www.sendmime.com ----- Original Message ----- From: "Mehta, Perdeep" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 30, 2002 4:30 PM Subject: [Perl-unix-users] Perl help | Hi All, | | I would appreciate any help on the following code. | | Here I fill the defln hash with the appropriate keys and values: | | use strict; | use warnings; | | my %defln = (); | | while (my $line = <FILE>) { | chop($line); | if ($line =~ /^$/) { | next; | } | else { | my @words = split(/\t+/, $line); | push(@{ $defln{$words[0]} }, $line); | } | } | | | Then I wish to retrieve the value associated with a key and work on it, | | my($defln) = @{ $defln{$words[0]} }; | my($string) = ($defln =~ /\s*\|([^|]+)\|/g); # string between two | pipes | print OUT "> $string\n"; | | Though the result is printed out but it throws following error that I could | not resolve, | | Use of uninitialized value in concatenation (.) or string at test.pl line | 103, <FILE> line 1895. | The line 103 points to the print statement. | | Thanks in advance, | perdeep | _______________________________________________ | Perl-Unix-Users mailing list | [EMAIL PROTECTED] | To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs | _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs