Chad Perrin wrote:
Y'know, I was playing around with this to see if I could come up with a
reasonably elegant solution, and I noticed a problem:
Your code doesn't seem to actually work. Am I missing something?
I went back to check, and it seems to only be working in very specific
cases. For
Hello List,
I'm writing a little script that will turn some webpages I have from
HTML to XHTML. This requires several substitutions. So far, I have
been able to write regexps that properly close link, meta, br, and hr
tags and either put in or replace an existing tag.
Finally, I want it t
Thanks, everyone, for the thoughtful replies. I do have a followup
question (see below).
Jay Savage wrote:
($str1, $str2, $str3) = (shift, shift, shift);
@d = [EMAIL PROTECTED];
On the other hand resizes @_. Now you only have one copy of each value
in memory. For a large list, this ma
Hello List,
I was wondering when it is appropriate to do multiple shifts on
parameters passed to a subroutine and when it is appropriate to just
feed it @_.
For example, you have:
&fancy_sub($a, $b, $c, @d);
Is it better (I'm leaving this term vague on purpose) to write:
sub fancy_sub {
Hello All,
I'm going through Schwartz's _Learning Perl Objects, References, and
Modules_. One of the exercises at the end of chapter 5 (I think),
requires a file called "coconet.dat" which is just a bunch of made up
data to practice autovivification, anonymous referencing, etc.
The file is
Hans Meier (John Doe) wrote:
Adam W am Mittwoch, 8. März 2006 00.49:
Sorry, I'm relatively new to programming in general (perl is my first
programming language), so I'm not sure what you mean by "sanitizing."
Could also be "sanitising", saw both :-)
I
Hans Meier (John Doe) wrote:
Adam W am Dienstag, 7. März 2006 23.16:
Hans Meier (John Doe) wrote:
just to sum up:
$test =~ s{ (.*?) \( (.*?) \) }
{$1}xsg;
- "\(" instead of "[(]": more readable
- no /m modifier : unnecessary with
Hans Meier (John Doe) wrote:
Adam,
just to sum up:
$test =~ s{ (.*?) \( (.*?) \) }
{$1}xsg;
- "\(" instead of "[(]": more readable
- no /m modifier : unnecessary without ^/$-anchors
- /s : may be appropriate for your html source text
:-)
Hans
The contex
JupiterHost.Net wrote:
$text =~ s!(.*?)\((.*?)\)!$1!g;
Thanks for the help and the more streamlined regexp.
An even better way (see O'reilley's "Perl Best Practices" by Damian
Conway - buy this book you will write better code)
Is to make it extremely readable with xms :)
Same exact
John W. Krahn wrote:
Adam W wrote:
Here is an example of one of my regexps that produces this warning:
$text =~ s!(.*?)(\()(.*?)(\))!\1<\/a>!g;
BTW, why capture $2 and $4 if you are not using them and why is everything
backslashed?
Since I'm relatively new to the language,
Hello All,
I'm using '-w' like any good hacker, but every time I try to use
backreferences in my regexps, I get a warning "\1 better written as $1
at"
I'm confused because, according to perlretut:
"Although $1 and \1 represent the same thing, care should be taken to
use matched variable
11 matches
Mail list logo