stallion has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks im trying to get the file names in a directory ..but its getting repeated again and again..Pls rectify
foreach $file (<*.*>) { if($file =~ /\.c/) { $filename = $file; print m"$filename\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Loop Break
by TomDLux (Vicar) on Jan 19, 2012 at 18:33 UTC | |
|
Re: Loop Break
by ww (Archbishop) on Jan 19, 2012 at 16:18 UTC | |
by JavaFan (Canon) on Jan 19, 2012 at 16:21 UTC | |
by ww (Archbishop) on Jan 19, 2012 at 16:33 UTC | |
|
Re: Loop Break
by RichardK (Parson) on Jan 19, 2012 at 16:28 UTC | |
|
Re: Loop Break
by toolic (Bishop) on Jan 19, 2012 at 17:51 UTC | |
|
Re: Loop Break
by locked_user sundialsvc4 (Abbot) on Jan 19, 2012 at 16:27 UTC | |
|
Re: Loop Break
by Anonymous Monk on Jan 19, 2012 at 15:59 UTC |