ooops. Now it is clear. And I got it all working. Thank you!

#!/usr/bin/perl # Demonstrate different loops for use with string substitutions use strict; use warnings; # use diagnostics; my $RevStr = "\tabc\tkis17.1.33en_12345.exe<h href"; my $NewRev; print "Original \$RevStr = <$RevStr>\n"; $NewRev = $RevStr; s/.*kis17/17/, s/.exe//, s/en_/./, s/\<h.*// for $NewRev; print "for at the end: \$NewRev = <$NewRev>\n"; $NewRev = $RevStr; $NewRev = $RevStr =~ s/.*kis17/17/r =~ s/.exe.*//r =~ s/en_/./r; print "run on line: \$NewRev = <$NewRev>\n"; #modified $NewRev = $RevStr; for ($NewRev) {s/.*kis17/17/; s/.exe.*//; s/en_/./; s/\<h.*//; } print "for at the start: \$NewRev = <$NewRev>\n"; $NewRev = $RevStr; for ($NewRev) #white spaces consumes no Mips! why so compact? { s/.*kis17/17/; #all 3 statements modify $NewRev s/.exe.*//; s/en_/./; } print "for at the start: \$NewRev = <$NewRev>\n\n"; __END__

./LeftToRight.pl
Original $RevStr = < abc kis17.1.33en_12345.exe<h href>
for at the end: $NewRev = <17.1.33.12345>
run on line: $NewRev = <17.1.33.12345>
for at the start: $NewRev = <17.1.33.12345>
for at the start: $NewRev = <17.1.33.12345>


In reply to Re^4: Need help with loop syntax errors by Todd Chester
in thread Need help with loop syntax errors by Todd Chester

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.