Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: How to eval an array element in regex's substitution

by Anonymous Monk
on Oct 27, 2010 at 06:23 UTC ( [id://867620]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to eval an array element in regex's substitution
in thread How to eval an array element in regex's substitution

Maybe you think it simply.
The $s is dynamic.It is maybe  "[2][1]" or maybe "[9]  [8] [3]",
. I only wanna to replace the  [xx]with a fix array's element.
But the rule is , the  [xx] is index of the array!

Replies are listed 'Best First'.
Re^4: How to eval an array element in regex's substitution
by aquarium (Curate) on Oct 27, 2010 at 21:52 UTC
    yes, i think in this case regex is too much, as it's only a fixed parameter substitution. regex can become easily overused. And when you use a regex you introduce pitfalls. I always go for simple substitution or other string operations first. substr and index functions come in very handy.
    regards testing smtp...just in case this is not common knowledge, you can telnet to port 25 on your smtp server and issue commands to send emails, just as a module would. it's great for testing the viability of a particular idea/method...and then you can see if a module can do it or needs some tweaking. For example, you would see that you can send multiple separate emails during one session/connection to smtp server. Mind you, setting up a massively parallel process to send emails isn't going to change much on the smtp server end, which serves a FIFO queue anyway. And using one connection/send/disconnection per email is useful as a unit of measure that one email send completed. I would argue that unless your program needs hours to complete (the bulk email send) that you should just send them one by one. it's also good not to hog/thrash the mail server.
    anyway, hope your project is progressing well.
    the hardest line to type correctly is: stty erase ^H

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-24 23:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found