kamal has asked for the wisdom of the Perl Monks concerning the following question:
I have just started to delve into Perl, and going through the following example:
-Kamal.
Reading the code....#!/usr/bin/perl use strict; use warnings; use Path::Class; my $dir = dir('foo','bar'); # foo/bar # Iterate over the content of foo/bar while (my $file = $dir->next) { # See if it is a directory and skip next if $file->is_dir(); # Print out the file name and path print $file->stringify . "\n"; }
my $dir = dir ('test1');
# local scalar dir is assigned by dir ('test1')
the dir on the RHS, being possibly from Path::Class (CPAN)
while (This condition hold true)
# Simple While
my $file = $dir->next
$dir scalar de-references the function next ? HOW ?
HOW do i guess that next would indeed be written as next and not next(), etc
since there is NO reference/example for "next" in
Class.pm
Same goes for stringify, or is_dir()
Now in this case is_dir() seems again to be a function, but how come its called differently
-Kamal.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Arrow Operator and questions related to Path::Class
by choroba (Cardinal) on Sep 11, 2012 at 14:44 UTC | |
Re: Arrow Operator and questions related to Path::Class
by kennethk (Abbot) on Sep 11, 2012 at 15:22 UTC | |
by nemesdani (Friar) on Sep 25, 2012 at 13:54 UTC | |
Re: Arrow Operator and questions related to Path::Class
by ww (Archbishop) on Sep 11, 2012 at 14:03 UTC | |
by kamal (Sexton) on Sep 11, 2012 at 14:43 UTC | |
by Corion (Patriarch) on Sep 11, 2012 at 14:47 UTC | |
by kennethk (Abbot) on Sep 11, 2012 at 15:27 UTC | |
by Anonymous Monk on Sep 11, 2012 at 15:52 UTC | |
Re: Arrow Operator and questions related to Path::Class
by Anonymous Monk on Sep 11, 2012 at 15:00 UTC |
Back to
Seekers of Perl Wisdom