Todd Chester has asked for the wisdom of the Perl Monks concerning the following question:
Hi All,
I am trying to write myself a demonstration of differenct types of word subsitutions in two differnt types of loops. Problem: I can't figure out all the syntax errors. Any help would be greatly approciated.
#!/usr/bin/perl # Demonstrate different loops for use with string substitutions use strict; use warnings; # use diagnostics; my $NewRev = "\tabc\tkis17.1.33en_12345.exe<h href"; my $RedirectUrl; s/.*kis17/17/, s/.exe//, s/en_/./ for $NewRev = $RedirectUrl; print "for at the end: \$RedirectUrl = <$RedirectUrl>\n\n"; $NewRev = $RedirectUrl =~ s/.*kis17/17/r =~ s/.exe//r =~ s/en_/./r ; print "run on line: \$RedirectUrl = <$RedirectUrl>\n\n"; for ($NewRev = $RedirectUrl) {s/.*kis17/17/; s/.exe//; s/en_//; } print "for at the start: \$RedirectUrl = <$RedirectUrl>\n\n"; END
Use of uninitialized value $_ in substitution (s///) at ./LeftToRight.pl line 12.
Use of uninitialized value $_ in substitution (s///) at ./LeftToRight.pl line 12.
Use of uninitialized value $_ in substitution (s///) at ./LeftToRight.pl line 12.
Use of uninitialized value $RedirectUrl in concatenation (.) or string at ./LeftToRight.pl line 13.
for at the end: $RedirectUrl = <>
Use of uninitialized value $RedirectUrl in substitution (s///) at ./LeftToRight.pl line 15.
Use of uninitialized value $RedirectUrl in substitution (s///) at ./LeftToRight.pl line 15.
Use of uninitialized value $RedirectUrl in substitution (s///) at ./LeftToRight.pl line 15.
Use of uninitialized value $RedirectUrl in concatenation (.) or string at ./LeftToRight.pl line 16.
run on line: $RedirectUrl = <>
Use of uninitialized value $_ in substitution (s///) at ./LeftToRight.pl line 18.
Use of uninitialized value $_ in substitution (s///) at ./LeftToRight.pl line 18.
Use of uninitialized value $_ in substitution (s///) at ./LeftToRight.pl line 18.
Use of uninitialized value $RedirectUrl in concatenation (.) or string at ./LeftToRight.pl line 19.
for at the start: $RedirectUrl = <>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help with loop syntax errors
by Marshall (Canon) on Sep 13, 2016 at 01:42 UTC | |
by Todd Chester (Scribe) on Sep 13, 2016 at 01:48 UTC | |
by Marshall (Canon) on Sep 13, 2016 at 01:55 UTC | |
by Todd Chester (Scribe) on Sep 13, 2016 at 02:18 UTC | |
by Marshall (Canon) on Sep 13, 2016 at 03:42 UTC | |
|
Re: Need help with loop syntax errors (warnings)
by Anonymous Monk on Sep 13, 2016 at 00:50 UTC | |
by Todd Chester (Scribe) on Sep 13, 2016 at 01:14 UTC | |
by Anonymous Monk on Sep 13, 2016 at 01:49 UTC | |
by Todd Chester (Scribe) on Sep 13, 2016 at 01:42 UTC |