in reply to Surprised by join
Unfortunally, there are a couple of bugs in perl related to this. First is that it will do a bogus call to FETCH before interpolating (FETCH is called once too often). Second is that perl gets mighty confused if FETCH returns an empty string. (Which is unfortunally just what you want).#!/usr/bin/perl use strict; use warnings; sub TIESCALAR { my $class = shift; bless [-1 => [@_]] => $class; } sub STORE {die} sub FETCH { ${$_ [0]} [1] [${$_ [0]} [0] ++ % @{${$_ [0]} [1]}]; } tie $" => main => ":", "-"; my @a = qw /0 1 0 1 0 1 0 1 0 1 0 1/; print "@a\n"; __END__ 0:1-0:1-0:1-0:1-0:1-0:1
Abigail
|
|---|