On Thu, Jul 01, 2004 at 04:14:37PM -0700, Jonathan Lang wrote:
> Juerd wrote:
>
> If you're really enamoured with the infix operator syntax, consider this
> possibility:
>
> sub infix:-> ($before, $after) {
> $before; # is this line redundant?
> return $after;
> }
> print $a -> $b -> $c; # prints $c
>
> where C[->] is read as "followed by". You could even set up a
> right-to-left version, C[<-], but why bother?
You could do this, but you'd be overriding the current meaning of
C<< -> >> as "pointy sub".
You could also use, 'before':
# Recipe for (un)holy water that will irk the altar's god.
step_on_altar();
drop_water($_) before pray() for @water_potions;
OOC, can you define an operator that is made up of alphanumerics, or
only punctuation? e.g., is this legal?
sub infix:before ( $before, $after ){ ... }
--Dks