Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

RE: RE: Re: regexp to return rest of string

by kirbyk (Friar)
on Jun 03, 2000 at 02:00 UTC ( [id://16144]=note: print w/replies, xml ) Need Help??


in reply to RE: Re: regexp to return rest of string
in thread regexp to return rest of string

I figured out this trick (or actually a variant) just by lots of trial and error with regexs in my early perl days. I prefer using parentheses rather than array subscripts, eg:

($relative_url) = ($string =~ /content(.*)/);

A _very_ useful version of this trick is with DBI, ie:

$getStuff = $dbh->prepare("select id, price, info from mytable");
$getStuff->execute();
($id, $price, $info) = $getStuff->fetchrow_array();
I use this a ton.

-- Kirby

Tuxtops: Laptops with Linux!

  • Comment on RE: RE: Re: regexp to return rest of string

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-26 00:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found