in reply to uninitialized value $_ in pattern match (m//)

[ The OP has since been changed ]

$subfamily = /[a-z]/ $name = /[a-z]/
is the same as
$subfamily = $_ =~ /[a-z]/ $name = $_ =~ /[a-z]/

Did you perhaps mean

$subfamily =~ /[a-z]/ $name =~ /[a-z]/

Also, make sure to use use strict;; it'll find another error.

Replies are listed 'Best First'.
Re^2: uninitialized value $_ in pattern match (m//)
by gvinu4u (Acolyte) on Jun 23, 2011 at 03:23 UTC

    ok I'll use it, mean while I've just updated the code output again.

    When I use strict, I get error like this which does not seem to be an issue for me but blocks the execution :(

    Global symbol "$file" requires explicit package name at Test.pl line 25.

    Execution of Test.pl aborted due to compilation errors.

      You read a variable named $file, but you never declared such a variable, much less assigned a value to it.

      I hadn't even seen that one! Goes to show how important use strict; is.

        Thanks a lot for the notification, I fixed it and again ran it and I got the same error n same amount of information :(

        Use of uninitialized value $subfamily in pattern match (m//) at Test.pl line 37, <$list> line 7.

        Use of uninitialized value $_ in pattern match (m//) at Test.pl line 42, <$list> line 7.

        Use of uninitialized value $family in concatenation (.) or string at Test.pl line 44, <$list> line 7.