On Thu, Apr 21, 2005 at 10:18:17AM +0200, Michele Dondi wrote: : Are the -X functions still going to be there? I definitely hope so!
Certainly. They're useful, and one of the things people love about Perl. In fact, we're enhancing them to be stackable, so you can say if -r -w -x $filename {...} to "and" the conditions. Or maybe there's a better solution to that now that we have junctions, on the order of if $filename ~~ -r & -w & -x {...} Then we also get our "or" for free. We'd just say that ~~ binds the default of -X just as it does m// or s///. The only fly in the ointment is that this is awfully ambiguous because -X is a unary operator looking for an argument, and you're not giving it one. But it might think the next thing is a sub ref starting with '&'. Ouch. Not sure where to go with that, other than require space or parens when ambiguous. : However, to come to the actual question, it has happened to me to have to : do, in perl5 that is: : : perl -lne 's/^"//;s/"$//;print if -e' : : or (less often) : : perl -lne '$o=$_;s/^"//;s/"$//;print $o if -e' : : : Ok: no much harm done (to my fingertips). But then, talking about : huffmanization, could a standard adverb be provided for -X's to the effect : of specifying that the passed filename is quoted, say in double (or if : sensible in single) quotes: for I find that to be a common filelist : "format". Ideally, what I'd like to do is : : perl -lne 'print if -e :q' It seems to me that -e «$_» would handle most of these cases, as long as whitespace always comes in quoted so that you always end up with one word. That seems more general than a special option to -X ops. Larry