in reply to Re^3: Remove empty element.
in thread Remove empty element.

But I get the error as,

Use of uninitialized value in split at santhosh.pl line 27. $VAR1 = [];

Following is the code I tried

use strict; use warnings; use Data::Dumper; my $test="[1,2second,3third,fourth]"; my ($list) = $test =~ /\[ ( [^\]] ) \]/x; my @var = split /,/, $list; print Dumper \@var;

Replies are listed 'Best First'.
Re^5: Remove empty element.
by Utilitarian (Vicar) on Jul 14, 2009 at 07:32 UTC
    There's a slight error in the regex,
    my ($list) = $test =~ /\[ ( [^\]]+ ) \]/x;
    resolves your issue here

      Thanks its working fine