Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: regular expression trouble

by NetWallah (Canon)
on May 31, 2013 at 14:39 UTC ( [id://1036257]=note: print w/replies, xml ) Need Help??


in reply to regular expression trouble

In addition to this, for the case when the key starts with "-" ( if (/^-/) ),
You are not appending to $names.

The "for" loop and "chop"s could be replaced by:

my $names = join ",\n", map {s/^-//; $_ } keys %data; my $values= join ",\n", map { m/$-/ ? $data{$_} : $dbh->quote($data{$_ +} } keys %data;
(I have made some assumptions on what you want done when the key starts with "-".)

             "I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
        -- Dr. Cox, Scrubs

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-03-29 06:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found