http://www.perlmonks.org?node_id=510919


in reply to Passing a database connection

Hey! Shouldn't my $dbh; sub new { $dbh = @_; } actually be my $dbh; sub new { $dbh = @_[0]; } ? Try it! It might work! This is because when passing arguments, the @_ has to have an index, starting at 0. If you would have two arguments, one would be @_[0](this is equal to your first argument) and another would be @_1(this is equal to your second, which you luckily don't have).