Hi, all, sorry for another perl question, what does $str =~ m/shared/ do? what is teh m option for? yes, another one, print qq~ <table>....</table>~ print qq|<table>....</table>| print <<EOT <table>...</table> EOT what is the difference between those three? Thanks all!
Darryl A. J. Staflund
Joined: Oct 06, 2002
Interesting, I didn't know that Perl was talked of at javaranch.com :-) Awesome, as I'm a long-time Perl-coder. A great site to find answers to your questions about Perl's regular expressions can be found at perldoc.com. In particular, read the following perldoc for answers to your questions: http://www.perldoc.com/perl5.6.1/pod/perlrequick.html Cheers, Darryl
Joined: Nov 25, 2002
what does $str =~ m/shared/ do? what is the 'm' option for? yes, another one, print qq~ <table>....</table>~ print qq|<table>....</table>| print <<EOT <table>...</table> EOT what is the difference between those three?
Hi. The first line of code is looking for the word 'shared' in the contents of $str. The other question is a little more complicated. Rather than use double quotes ( "" ) to enclose the argument to the print function, you can use ( qq ) which means the same thing. Either of these also allow variable interpolation ( translating a variable to it's value ). A pair of single quotes would be a ( q ) on each side ( which doesn't allow variable interpolation ). The '~' and '|' symbols simply enclose the arguments in the same manner as this would: print "I am going to the store."; The last one is known as a 'Here' document and I would write it like this: print <<EOF; <TABLE>...</TABLE> EOF This saves you the trouble of using a print statement on every line. You must place both the beginning of the 'Here' document and the end against the left-most edge and there cannot be a space between the << symbols and the name of the 'Here' document ( EOF in this example ). Hope this helps, -Caitlin.