Ohad Ohad said: > lets say: > $_ = "Hello"; > > With the following subs calls: > > 1. sub(m/H/); > 2. sub(m/R/); > 3. sub(m/H/, 1); > 4. sub(m/R/, 1); > > Now when I check @_ inside sub I get. > > 1. ('1'); > 2. ();#Empty > 3. ('1', 1); > 4. (1)#??? Wierd doesn't sub knows it's getting two parameters (due to > the comma)? > > Can anyone shed light on this. > > I guess the main questions are: > What exactly is FALSE as returned by match (or any other boolean op)? > Why in cases 2 & 4 (mainly 4) the list of variables to the sub looks > like it does.
m/R/ is being called in a list context. In a list context it returns the empty list () on failure. The empty list is interpolated into the list of arguments to the sub and effectively removed. Hence the behaviour you are seeing. perldoc perlop perldoc perldata > 10x a LOT. 101010101010101010101010101010101010101010101010101010101010101010101010 -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]