* this is another way to say "undocumented behavior -- for recreational use only"
#!perl -l use strict; use warnings; package Tattle; sub TIESCALAR { return bless []; } sub FETCH { my $self = shift; my $thiscount = $self->[1]; ($self->[1] += 1) %= @{$self->[0]}; " $self->[0][$thiscount] "; } sub STORE { my $self = shift; @$self = (shift, 0); } package main; my @arr = ('a'..'g'); tie my $sep, 'Tattle'; $sep = ['*', '+', '-', '=']; print join $sep, @arr;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Fun with join
by chanio (Priest) on Apr 03, 2005 at 05:54 UTC |