I'm trying to make a fairly large chunk of code smaller -- and one way
that I've "figured out" how to do it, is similar to:
my $f = "foo"; # The glob I want
my $b = test($f); # $b should be a ref to *foo
my @foo = qw(foo bar zed); # @foo, should be a part of the *foo glob?
print $b join("~", @{$b})."\n"; # I'm trying to get @foo -- @{$b}
close($b);
sub test {
my $fh = shift;
open($fh, "> test.txt");
return \*$fh;
}
I've tested this, and I get "not an ARRAY reference...", for the @{$b}
construct.
Is there any way to do something similar to this, or am I crazy? (the
chunk of code that I had crafted to do something similar saves me ~30
lines of ugly (I think) code)
Thanks...
-Andrew