On Mon, 22 Jun 1998, Alex K Suska wrote: > This question is for those who have perhaps delved deep into the MacPerl > viscera, that I believe has to do with the localizations of certain special > variables, namely $& and $': > > while ( $formInfo =~ > m~(<(input|select|option|(/select)|textarea|(/textarea)).*?>)~igo ) { > $formTag = $&; # get match value > $rest = $'; # get rest text > print $formTag, $&; > if ( $formTag =~ /^<option/io ) { # Select Option tag > $formTag .= ( $rest =~ m{(.*?)\n|<}io )[0]; # Add to EOL or next ^^ > } > elsif ( $formTag =~ /^<textarea/io ) { > $formTag .= ( $rest =~ m{(.*?)</textarea>}sio )[0]; # Add to </TEXTAREA> > } > push @tags, $formTag; > } > > In MacPerl, this code will extract all form tags from $fromInfo into @tags. In > any other ( as far as I can tell, DOS/UNIX) $& and $' are empty. Does anyone > know why? > > Alex Maybe you should check the format of the HTML file you are feeding your script with. As you use an "\n" in your regexp, it will success only if there is a newline,. (The old newline debate.. :) If your file use MacOS newlines (CR) and that you run this script under MacPerl, that's ok, but if you run it under DOS or Un*x, it will fail (because Uni*x newlines are LF and DOS are CRLF). The solution is to convert the file to the native platform format. Hopes this helps. Sebastien Aperghis-Tramoni mailto:Sebastien.Aperghis@esil.univ-mrs.fr mailto:madingue@cis.uni-muenchen.de http://www.resus.org/~madingue mailto:madingue@mail.resus.univ-mrs.fr ---------- ---------- Perl has no bug : only unexpected or unwished features. ---------- ---------- #!perl -w print join('', map(ord>64?++($a=$_):$_,split(//,<<END)),"\n"); Odqk gz@{["\b"]}r mn atf : nmkx tmdwodbsdc nq tmvhrgdc edz@{["\b"]}stqdr. END ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch