New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Successfull match $_[0] =~ /foo(.+)/ overrides $_[0] if function called as foo($1) #12599
Comments
From sp@smartspb.netCreated by sp@smartspb.netThis is a bug report for perl from sp@smartspb.net, ----------------------------------------------------------------- ###### script ###### sp@uskr:~/3 (1570) cat u.pl sub foo { # ok say 'call foo("foo123");'; # at least strange say 'call foo($1);'; ###### output ###### sp@uskr:~/3 (1571) perl u.pl call foo("foo123"); sp@uskr:~/3 (1572) ###### summary ###### I'm not sure is that bug or feature. Perl Info
|
From @maukeOn 19.11.2012 18:17, sp@smartspb.net (via RT) wrote:
This is not a bug. Quoting perldoc perlsub: Any arguments passed in show up in the array @_ . Therefore, if you -- |
The RT System itself - Status changed from 'new' to 'open' |
From @druud62On 2012-11-20 22:57, Lukas Mai wrote:
Workaround: local $1. (at the start of the sub) Do we need a feature that auto-localizes the numbered capture variables -- |
From @doyOn Wed, Nov 21, 2012 at 01:20:19AM +0100, Dr.Ruud wrote:
No. The behavior here is the same behavior as my $a; which prints foo It has nothing to do with capture variables, it happens for any variable -doy |
From @epaThis is an issue which comes up perenially, see http://thread.gmane.org/gmane.comp.lang.perl.perl5.porters/1607 for an earlier 'bug' report. I do feel that the current behaviour is confusing, if every time a new |
From @epaOn Tue Nov 20 16:26:18 2012, doy@tozt.net wrote:
I believe it's not the same behaviour as the example you gave. my $a; This prints foo bar bar. But the analogous code using $1 sub foo { prints foo bar foo. So while in the case of a global variable you set |
From @doyOn Wed, Nov 21, 2012 at 03:55:43AM -0800, Ed Avis via RT wrote:
This is just a side effect of how $1 works in general - any assignments "foo" =~ /(.*)/; also outputs foo The current behavior is the only thing that actually makes sense, given -doy |
From @epaJesse Luehrs <doy <at> tozt.net> writes:
I suggest that if we are stuck with the current behaviour, there should be a -- |
From zefram@fysh.orgWith no bug here, this ticket should be closed. -zefram |
@iabyn - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#115834 (status was 'rejected')
Searchable as RT115834$
The text was updated successfully, but these errors were encountered: