> my $sepchar = grep( /,/ => @_ ) ? ";" : ","; > And I also don't understand what ";" is doing in the ternary operator?? The ";" is what is returned if the condition is TRUE.
"( / ,/ => @_)" is a(n anonymous) hash. I've had no idea that grep can operate on a hash. However, it seems that "grep( / ,/ => @_)" and "grep( / ,/, @_)" are equivalent. __CODE__ @a = qw/aa ab ba bb/; print join(", ", grep(/a/, @a) ); print "\n"; print join(", ", grep(/a/ => @a) ); print "\n"; __END__ aa, ab, ba aa, ab, ba @_ is a list/array, and that is what grep is searching for the RegEx / ,/. @_ is the arguments passed into the current function/sub. In this context, grep is being used in a scalar context. So it returns the number of times that "the expression is true", ie the number of elements that contain a " ,". In a TRUE/FALSE context, it returns whether any of the passed arguments have a " ,". If there is a " ," in one of the arguments, the $sepchar is set to ";". Otherwise it is set to ",". HTH! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/