I have this: #!/usr/bin/perl6 use v6; sub MAIN( :$debug = False, :$verbose = False ) { $verbose = True if $debug; say "verbose={$verbose}, debug={$debug}"; } $ ./tt.p6 verbose=False, debug=False $ ./tt.p6 --verbose verbose=True, debug=False $ ./tt.p6 --debug Cannot assign to a readonly variable ($verbose) or a value in sub MAIN at ./tt.p6 line 6 in block <unit> at ./tt.p6 line 4
So $verbose is read-only. I think the compiler could have told me this a compile time? I try to fix it: ... sub MAIN( :$debug = False, :$verbose is rw = False ) { ... $ ./tt.p6 --debug ===SORRY!=== Error while compiling /home/ngaywood/./tt.p6 Cannot use 'is rw' on optional parameter '$verbose'. at /home/ngaywood/./tt.p6:4 Not sure what the neat way of doing this is. -- Norman Gaywood, Computer Systems Officer School of Science and Technology University of New England Armidale NSW 2351, Australia ngayw...@une.edu.au http://turing.une.edu.au/~ngaywood Phone: +61 (0)2 6773 2412 Mobile: +61 (0)4 7862 0062 Please avoid sending me Word or Power Point attachments. See http://www.gnu.org/philosophy/no-word-attachments.html