in reply to Re^2: How to detect a hash container key from a referenced sub value
in thread How to detect a hash container key from a referenced sub value

what always stopped me was that, i might be wrong, the requirement to create a module, describing the object in the separate file instead of just ability to make an object in the same file as the script.

You don't necessarily need separate files.  Separate packages, yes, but you can have more than one package in the same file (if you really want):

#!/usr/bin/perl package Foo; sub new { my $class = shift; return bless { @_ }, $class; } # ... package Bar; sub new { my $class = shift; return bless { @_ }, $class; } # ... package main; # the actual script my $foo = Foo->new( myattr => "foo" ); # create an obj use Data::Dumper; print Dumper $foo; __END__ $VAR1 = bless( { 'myattr' => 'foo' }, 'Foo' );
  • Comment on Re^3: How to detect a hash container key from a referenced sub value
  • Download Code