At 12:41 AM +0800 3/8/12, lina wrote:
Hi,
$ ./substr_accessing_examples.pl
Undefined subroutine &main::subst called at
./substr_accessing_examples.pl line 15.
#!/usr/bin/env perl
use strict;
use warnings;
#
# get a 5-byte string, skip 3 bytes,
# then grab two 8-byte strings, then the rest;
#
# (my $leading, my $s1, my $s2, my $trailing) = unpack("A5 x3 A8 A8
A*", my $data);
my $string = "This is what you have.";
my $first = subst($string,0,1);
print $first, "\n";
I don't know how to find the one like use warnings module contains the substr
You have misspelled the function. What more do you want Perl to tell
you? The correct name? There is no spell checker in Perl with
suggested corrections. It is up to you to determine the correct name.
You already seem to know the correct name, as you have included it in
the name of your program. What exactly are you expecting from the
Perl compiler?
If you want more verbose diagnostic messages, you can add 'use
diagnostics;' to your program. However, in this case it isn't going
to tell you anything more than Perl doesn't know anything about a
subst function.
--
Jim Gibson
j...@gibson.org
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/