http://qs321.pair.com?node_id=689063


in reply to Half-serious quest for prefix anonymous refs taking

blazar writes:

Yet it somehow bothers me to have to assign to a temporary variable only to take a reference to it,
Except that a holder for the data is also created which will persist until the reference you created is destroyed. So it's not really 'temporary' and when viewed in that light the syntax does not appear so arbitrary.

For quick and dirty code I'd write your dopen like this:

sub dopen { my $ref = []; @$ref = map { open my $fh, '<', $_ or warn "Can't open `$_': $!\n"; <$fh>; } @_; return $ref; }
Which communicates the intent of passing a reference. It's also more in line with the syntax of an object constructor should you need to rewrite using objects.

It seems like what you are really trying to do is to re-invent perl objects outside of the symbol table. Which I'm not convinced would be such a good idea.


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}