Yary Hluchan writes:
 > a = arcadi shehter <[EMAIL PROTECTED]>
 > a>I think this was already discussed once and then it was proposed to
 > a>attach a property to characters of the string
 > a>
 > a> sub peek_at_sky {
 > a>
 > a>     my Color  @numbers = peek_with_some_hardware;
 > a>
 > a>     my $say_it =  join map { "1" but color($_) } @numbers ;
 > a>     return $say_it ;
 > a> }
 > a>
 > a>
 > a>   rule color { (.) { let $0 := $1.color } }
 > a>
 > a>   $daylight = &peek_at_sky =~ /<color>+/; # is something in sky
 > 
 > That works and isn't too bad, a quick fix with some interesting
 > possibilities. Should be an example in the documentation. Still,
 > the RFC that opened this discussion opens a different way-
 > 
 > http://dev.perl.org/rfc/93.html
 > http://www.perl.com/pub/a/2002/06/04/apo5.html?page=17#rfc%20093:%20regex:%20support%20for%20incremental%20pattern%20matching
 > 
 > Once a user-defined sub can hand characters to rexen- it could hand
 > anything over (floats, refs, etcetera).  It's an opportunity ripe
 > for exploitation.
 > 


sorry , it was proposed to be like that 

 sub peek_at_sky {

     my Color  @numbers = peek_with_some_hardware;
     my Str    @words = map { "1" but color($_) } @numbers 

     my $say_it is from( @words )  ;

     return $say_it ;
 }

   rule color { (.) { let $0 := $1.color } }
   $daylight = &peek_at_sky =~ /<color>+/; # is something in sky


Reply via email to