Mark Sargent wrote:
> Hi All,

Hello,

> am new to Perl. I'm followig this tutorial,
> 
> http://www.cs.unc.edu/~jbs/resources/perl/perl-basics/variables.html

That web site was last updated 8 years ago and is talking about Perl4 while
the current version of Perl is 5.8.  And even if you are still using Perl4
(ick) there are some serious errors there:

http://www.cs.unc.edu/~jbs/resources/perl/perl-basics/variables.html
    access

        Individual items in array accessed as scalars.

            $aList[0] # first item in @aList
            $aList[0,1] # slice, first two items in @aList

$aList[0,1] is NOT a slice of two items because the '$' at the front means
that it is a scalar or one item.  A slice would be @aList[0,1].


http://www.cs.unc.edu/~jbs/resources/perl/perl-basics/regular_expressions.html
join( )

    Approximately the opposite of split. Takes a list of values, concatenates
    them, and returns the resulting string.

    Form:

        $var = join("item_1", $item2, . . .);


    Example:

        $a = join('cat", "dog", "bird"); # returns "catdogbird" $a = join($b, 
$c);

That is incorrect.  join("cat", "dog", "bird") returns "dogcatbird"


http://www.cs.unc.edu/~jbs/resources/perl/perl-basics/io.html
5.1 File system I/O

    standard files

        Perl provides access to the standard files: STDIN, STDOUT, and STDERR.

STDIN, STDOUT, and STDERR are not files, they are filehandles which are
usually connected to the file /dev/tty on Unix systems.


http://www.cs.unc.edu/~jbs/resources/perl/perl-basics/system.html
opendir

    Opens a directory so that subsequent operations can read the members of
    the directory, as described below. Takes two arguments: a filehandle that
    will be used with subsequent readdir operators and the path to the
    directory to be opened; the operator returns true/false indicating
    success/failure.

opendir and its relatives do NOT use filehandles they use directory handles
and you cannot perform filehandle operations on a directory handle nor can you
perform directory handle operations on a filehandle, for example:

opendir A, 'directory' or die $!;
open A, 'file' or die $!;  # OK, filehandle A is different then dir handle A

$a = <A>;  # reads from filehandle A

opendir B, 'dir' or die $!;

$b = <B>;  # won't work because B is a directory handle!




All in all I would say that this is a very old and not very good tutorial.



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to