in reply to splitting a string that appears inconsistently in structure

First of all, it's usually a bad idea to use prototypes. See Far More Than Everything You've Ever Wanted to Know about Prototypes in Perl.

Second, it might help if you could show some examples of the strings you're trying to deal with.

In Perl 5.10, there's a "defined or" operator, "//". You can say this:

$method //= '';

That will set $method to the empty string if it's not defined. In earlier versions, you'd have to do this:

$method = '' if ! defined $method;

You could put this in a sub and use it like this...

defined_or( $method, '' ); # changes the caller's variable sub defined_or { if ( ! defined $_[0] ) { $_[0] = $_[1]; } }

You could probably cook up a pattern that would match all the things you want to match, but you'd still end up with variables set to undef when you're done.

If you just want to suppress the warnings, you can say:

no warnings 'uninitialized';

It's good to restrict that to the smallest possible scope, however, so it's probably better to make sure everything is defined. See perllexwarn for the details.