CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Regular Expressions: Re: [Jean] Simple regex problem: Edit Log


Aug 7, 2002, 2:07 AM

Views: 23242
Re: [Jean] Simple regex problem

i already knew about the default parameters and such, but i'm still learning about a lot of the not-so-apparent things in perl, like the shift thing for example. i'm also still trying to understand some things like this:

 $string = "Yes, we have no bananas, cabbage, or shrubbery."; 
$var = ($string =~ /\s(\w+),/)[0];

why doesn't [1] return "cabbage"? does it only match things once and put it into one element? if so, what's the point? Tongue

one more for the road Tongue

 $blah = q(magic%jellybeans%have%sprouted%in%my%head); 

print bars('in');

sub bars {
print shift; }

why does this return 'in1' instead of just 'in'?

thanks for helping guys Cool

(This post was edited by NuclearClam on Aug 7, 2002, 2:09 AM)

Edit Log:
Post edited by NuclearClam (Novice) on Aug 7, 2002, 2:09 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives