On Mon, 2009-01-26 at 16:20 +0100, Bill Harpley wrote:
> foreach $entry(@list)
> {
> 
>         $entry =~ /\[([a-z0-9]{5})\]/;
> 
>         print "$1\n";           # print to screen
> 
>         # print FILE "$1\n";            # print to file
> }

If there is no match, you are printing a uninitialized value; try:

foreach my $entry ( @list ){
  if( $entry =~ m{ \[ ( [a-z0-9]{5} ) \] }msx ){
    my $request_id = $1;
    # ...
  }
}


-- 
Just my 0.00000002 million dollars worth,
  Shawn

"It would appear that we have reached the limits of what it is
 possible to achieve with computer technology, although one should
 be careful with such statements, as they tend to sound pretty silly
 in 5 years."
   --John von Neumann, circa 1960


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