in reply to Perl - 'count word'

Perhaps you could specify more clearly what you are trying to accomplish.

The Unix piped command you mentioned, ls -d 246.56*  |wc -l, will count the number of entries (files, directories, etc.) in the current working directory whose names match 246.56* (for example, 246.56, 246.561, 246.56_foo). If no entries are found matching that name specification, then you get the No such file or directory error message.

This is one way to count the number of entries while avoiding the error message:

#!/usr/bin/env perl use warnings; use strict; my $count = 0; opendir my $dh, '.' or die "$!\n"; while (defined(my $entry = readdir($dh))) { $count++ if ($entry =~ /^246.56/); } closedir $dh; print "count=$count\n";

If you are familiar with Unix commands but are just starting out with Perl, UNIX 'command' equivalents in Perl is a handy reference.