Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!bcm!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: Patterns vs Strings Message-ID: <1991Feb08.034916.29904@convex.com> Date: 8 Feb 91 03:49:16 GMT References: <121642@uunet.UU.NET> <1991Feb07.210023.8308@convex.com> <121661@uunet.UU.NET> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 51 Nntp-Posting-Host: pixel.convex.com From the keyboard of rbj@uunet.UU.NET (Root Boy Jim): :However, m'$var' == m"$var" == m`$var`. And tr is brain dead. :I have to use eval to get vars into either side. Well, I wouldn't call tr braindead just because it doens't do something it's not documented to do. I think that this illustrates that single quotes DO matter: $_ = 'contains $foo in it'; $foo = 'bar'; print "match in singles: ", m'\$foo', "\n"; print "match in doubles: ", m"$foo", "\n"; print "match in backs: ", m`$foo`, "\n"; $foo = 'tain'; print "foo is $foo\n"; print "match in singles: ", m'\$foo', "\n"; print "match in doubles: ", m"$foo", "\n"; print "match in backs: ", m`$foo`, "\n"; :However, once again, I have not made myself clear. I am talking :about the first argument to split and join. Normally, you can't :just go passing strings to functions/operators by /quoting/ with slashes. I wouldn't say "normally" -- I would say "never"! Putting /slashes/ around a string it a run-time pattern match against $_. This: join(/foo/, 'a', 'bird', 'in', 'the', 'hand'); yields 'a1bird1in1the1hand' if you leave $_ at what it was above, and 'abirdinthehand' in most other cases. :And by "data types", I meant "string" vs "numeric". I know.... But those are just the same scalar data type, which is a wee bit polymorphic. But this part might just be a matter of semantics. --tom -- "All things are possible, but not all expedient." (in life, UNIX, and perl)