kulls has asked for the wisdom of the Perl Monks concerning the following question:
Can I add this line before the assignment ? Is there any other option ?#!c:\bin\perl use warnings; my $str="name"; my $index=12; my $s=substr($str,$index,1); print $s; __OUTPUT__ substr outside of string at - line 3. Use of uninitialized value in print at - line 4.
Thanks -kullsexit if(length($str)< $index);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: substr outside of string
by syphilis (Archbishop) on Sep 09, 2006 at 10:21 UTC | |
by hgolden (Pilgrim) on Sep 09, 2006 at 13:49 UTC | |
by ikegami (Patriarch) on Sep 09, 2006 at 18:40 UTC | |
by hgolden (Pilgrim) on Sep 09, 2006 at 19:29 UTC | |
by Anonymous Monk on May 03, 2012 at 05:23 UTC |