Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Learn Regex or Perl Frist?

Reply
Thread Tools

Learn Regex or Perl Frist?

 
 
Uri Guttman
Guest
Posts: n/a
 
      11-17-2003
>>>>> "JWK" == John W Krahn <(E-Mail Removed)> writes:

JWK> Ben Morrow wrote:
>>
>> One of the things it can be is a regex, and there is a special
>> operator '=~' in Perl which means 'match this regex against this
>> string'.


JWK> Actually =~ is the binding operator and if used with tr/// there is no
JWK> regex involved.

that is a good point that is not mentioned often enough. but what does
this do?

'abc' =~ ( foo() . $bar ) ;

uri

--
Uri Guttman ------ http://www.velocityreviews.com/forums/(E-Mail Removed) -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
 
Reply With Quote
 
 
 
 
John W. Krahn
Guest
Posts: n/a
 
      11-17-2003
Uri Guttman wrote:
>
> >>>>> "JWK" == John W Krahn <(E-Mail Removed)> writes:

>
> JWK> Ben Morrow wrote:
> >>
> >> One of the things it can be is a regex, and there is a special
> >> operator '=~' in Perl which means 'match this regex against this
> >> string'.

>
> JWK> Actually =~ is the binding operator and if used with tr/// there is no
> JWK> regex involved.
>
> that is a good point that is not mentioned often enough. but what does
> this do?
>
> 'abc' =~ ( foo() . $bar ) ;


Something similar to:

'abc' =~ /@{[ foo() ]}$bar/ ;


John
--
use Perl;
program
fulfillment
 
Reply With Quote
 
 
 
 
Uri Guttman
Guest
Posts: n/a
 
      11-17-2003
>>>>> "JWK" == John W Krahn <(E-Mail Removed)> writes:

JWK> Uri Guttman wrote:
>>
>> >>>>> "JWK" == John W Krahn <(E-Mail Removed)> writes:

>>

JWK> Ben Morrow wrote:
>> >>
>> >> One of the things it can be is a regex, and there is a special
>> >> operator '=~' in Perl which means 'match this regex against this
>> >> string'.

>>

JWK> Actually =~ is the binding operator and if used with tr/// there is no
JWK> regex involved.
>>
>> that is a good point that is not mentioned often enough. but what does
>> this do?
>>
>> 'abc' =~ ( foo() . $bar ) ;


JWK> Something similar to:

JWK> 'abc' =~ /@{[ foo() ]}$bar/ ;

correct (except for the context. in mine foo() is called in scalar
context and yours calls it in list context).

my point is that =~ is the binding operator but given just an expression
on the right side (no //, m//, s/// or tr///) it will assume m// for the
expression and compile it as such. so =~ has some regex flavor to it as
well as binding. but i do dislike it being called the regex op (mostly
by newbies who don't know about tr/// and that it is not a regex op).

uri

--
Uri Guttman ------ (E-Mail Removed) -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
 
Reply With Quote
 
Iain Truskett
Guest
Posts: n/a
 
      11-18-2003
* Don Kim <(E-Mail Removed)>:
> "James Willmore" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) phia.net...


[...]
> > Being an owner of the book mentioned I can say this -
> > unless you're going to be doing what the author has done
> > with regular expressions, save your money. If you
> > *must* have a book, get the pocket book by the same
> > title ($12(?) versus $30(?) for the full book).


> Actually, I already purchased the book, but I got it used
> for $12 so it was worth it. I hear you though, I'm sick
> of buying books only to find it wasn't useful to me.


http://iain.truskett.id.au/MiniOwlBook for my view on the
pocket reference.

As you have "Mastering Regular Expressions" (there are 2
editions and I'm not sure which you have, but for beginners
both are good) you have one of the best introductions to
regex around. If you can follow the book, you'll not only
know regex, you'll _understand_ regex and how they work and
why they give the results they do. Which is far better than
just knowing the syntax.

If you're going to learn Perl, it's good to learn regex as
well. Most tutorials cover them fairly early on.

If you're going to learn regex, you may as well learn Perl
as it's a great language to use to play with regex, and has
one of the best implementations.


cheers,
--
Iain.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Some information for the one who decided to learn C++, and now wantsto learn at least a bit of C? Alexander C Programming 20 09-11-2010 01:04 AM
How make regex that means "contains regex#1 but NOT regex#2" ?? seberino@spawar.navy.mil Python 3 07-01-2008 03:06 PM
Learn the language before you learn the GUI. CoreyWhite C++ 1 03-31-2007 08:56 PM
newbie question: should I learn TKinter or skip it and learn more advanced toolkit? Porky Pig Jr Python 3 05-12-2004 08:58 AM
perl regex to java regex Rick Venter Java 5 11-06-2003 10:55 AM



Advertisments