Stories
Slash Boxes
Comments
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.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • use Devel::BeginLift qw( init_var );

    sub init_var(\[$%@];@) {
        my $var = shift;
        if    ( 'ARRAY' eq ref $var ) { @$var = @_ }
        elsif ( 'HASH'  eq ref $var ) { %$var = @_ }
        else                          { $$var = $_[0] }
        return;
    }

    init_var my @foo => qw/ bar baz /;

    BEGIN { print "@foo\n" }

    =begin output

    bar baz
    • Beautiful! Mind if I clean this up and post it to the CPAN? (Or you can since you posted the code. Seems unfair to steal it from you :)

      • I was going to, but it’s obviously not going to happen, so if you want to go ahead, then do.

        • Heh. I'm heading on holiday for over a week. I doubt I'm going to get around to it, either :)