Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added Altreus' irc ramblings as a reminder.

  • Loading branch information...
commit 4184ce5e9193d781a4959aa39be511820576acc4 1 parent 80188a2
@bingos authored
Showing with 32 additions and 0 deletions.
  1. +32 −0 preg_replace.pl
View
32 preg_replace.pl
@@ -21,3 +21,35 @@ (\[$@]\[$@]@)
my $str = 'This is bleh';
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
Please sign in to comment.
Something went wrong with that request. Please try again.