Skip to content

Commit

Permalink
Added Altreus' irc ramblings as a reminder.
Browse files Browse the repository at this point in the history
  • Loading branch information
bingos committed Sep 7, 2010
1 parent 80188a2 commit 4184ce5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions preg_replace.pl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -21,3 +21,35 @@ (\[$@]\[$@]@)
my $str = 'This is bleh'; my $str = 'This is bleh';
preg_replace( @foo, @bar, $str ); preg_replace( @foo, @bar, $str );
} }

exit 0;

__END__
[10:57] < BinGOs> Hmmm I wonder where that preg_replace() in perl I started is.
[10:58] < buu> Good lord why
[10:58] < BinGOs> It seemed like a laff
[10:59] < Altreus> BinGOs: phpreg_replace :P
[10:59] < BinGOs> Actually I quite liked that you could provide arrays of stuff.
[11:00] < BinGOs> Aha found it.
[11:01] < Altreus> BinGOs: so s/shift/shift/ while scalar (@stuff)
[11:02] < Altreus> where @stuff = List::MoreUtils::zip(@regexes, @replacements)
[11:02] < buu> If that worked, yes.
[11:02] < BinGOs> >:)
[11:03] < Altreus> buu: no u work
[11:03] < BinGOs> http://php.net/manual/en/function.preg-replace.php
[11:04] < Altreus> s/shift/@{[shift]}/ while scalar (@stuff)
[11:04] < Altreus> :3
[11:05] < Altreus> eval: @stuff = (qr/1/, 'a', qr/2/, 'b'); $_ = "12345678"; s/shift/@{[shift]}/ while scalar (@stuff); $_
[11:05] < Altreus> :(
[11:05] < buubot> Altreus: No output.
[11:05] < Altreus> stupid @stuff
[11:05] < Altreus> change ok
[11:05] < rindolf> Altreus: the left-hand-shift is wrong.
[11:05] < Altreus> how so
[11:05] < rindolf> Altreus: it will be interpreted as the string "shift".
[11:06] < Altreus> really?
[11:06] < Altreus> hmm
[11:06] < rindolf> Altreus: yes.
[11:06] < Altreus> still, the while does not re-eval scalar @stuff
[11:06] < Altreus> superfluous scalar of course

0 comments on commit 4184ce5

Please sign in to comment.