From: tamouse mailing lists Date: 2013-04-24T13:00:52+09:00 Subject: Re: what is the $- magic global? On Tue, Apr 23, 2013 at 9:21 PM, Matthew Kerwin wrote: > Also: I'm aware of bash's $- options description, but that doesn't seem > relevant in this case; bash's $- is a simple string, and doesn't have > any magic attached. > > I know that perl and ruby both have a similarly-defined $+ magic > variable. Perl also has a $- ("The number of lines left on the page of > the currently selected output channel.") but I doubt there's a > correlation with ruby's, because perl's is a simple integer, and is > related to $~ and $= which are completely different between the two > languages. > > I've also encountered perl's @-/@+ match offsets, but can't see how > they'd be relevant. Hummm... I'm flummoxed as well. I just went through the newest Programming Ruby book (beta 2) and cannot find anything referencing $-. It lists these: $-0 → String Synonym for $/ $-F → String Synonym for $; $-a → Object True if the -a option is specified on the command line $-d → Object Synonym for $DEBUG. $-i → String If in-place edit mode is enabled (perhaps using the -i command-line option), $-i holds the extension used when creating the backup file. $-I → Array Synonym for $: $-l → Object Set to true if the -l option (which enables line-end processing) is present on the command line. $-p → Object Set to true if the -p option (which puts an implicit while gets...end loop around your program) is present on the command line. $-v → Object Synonym for $VERBOSE. $-w → Object Synonym for $VERBOSE. $-W → Object Return the value set by the -W command-line option. and this: "a global variable name can be formed using $- followed by a single letter or underscore" [p 318 in PDF] but no bare $- variable....