Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Obviously you want this:

    $image = \do{my $x=$image} unless ref $image;

    However, that will make a copy of the value before taking a reference, eating up memory. What we would really like here is to attach the data to another container without copying it and then store a reference to that container in the current one. Well, with Data::Alias from the CPAN, we can:

    if ( not ref $image ) {
        my $x = \$image;
        alias { ( $image, $x ) = ( $x, $image ) };