Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

RE: Dark Theme for /. through Perl

by Alokito (Novice)
on May 16, 2000 at 09:49 UTC ( [id://11817]=note: print w/replies, xml ) Need Help??


in reply to Dark Theme for /. through Perl

For the sake of all that's holy, use some line breaks!
I was scrolling for a while to catch the end of the code...
I guess it would be kind of silly to change something like
$site =~ s/<BODY bgcolor="#000000" text="#000000" link="#00 +6666" vlink="#000000">/<BODY bgcolor="#000001" text="#4FFFAF" link="# +00BBBB" vlink="#4F2F9F">/;
to
my $from = '<BODY bgcolor="#000000" text="#000000" link="#006666" +vlink="#000000">'; my $to = '<BODY bgcolor="#000001" text="#4FFFAF" link="#00BBBB" vl +ink="#4F2F9F">'; $site =~ s/$from/$to/;
Perhaps extended regexps are the answer?
$site =~ s/ <BODY\sbgcolor="\#000000"\stext="\#000000"\slink="\#006666"\svlink +="\#000000"> /<BODY bgcolor="#000001" text="#4FFFAF" link="#00BBBB" vlink="#4F2 +F9F">/x;
Or even
$site =~ s/ <BODY[ ]bgcolor="\#000000"[ ]text="\#000000"[ ]link="\#006666"[ ]v +link="\#000000"> /<BODY bgcolor="#000001" text="#4FFFAF" link="#00BBBB" vlink="#4F2 +F9F">/x;
What do you think? It looks a little ugly, I suppose.

Instead of useing extended regexps, we could just use the
(somewhat less well known) regexp extensions:

$site =~ s/<BODY bgcolor="#000000" text="#000000" link="#006666" vlink +="#000000">(?# )/<BODY bgcolor="#000001" text="#4FFFAF" link="#00BBBB" vlink="#4 +F2F9F">/;
Which is probably the way to go.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11817]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-16 20:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found