Ravinder Chauhan wrote:
> 
> After installing Perl 5.8 my @files = system("dir bex*.* /od /b") function
> has started behaving strange. Under 5.6 this function used to return the
> list of files for matching files, however now in place of file list it is
> returning a number "65280". I would appreciate if someone could help me in
> this.

>From Perl version 5.6.0:

       system LIST

       system PROGRAM LIST
[snip]
               The return value is the exit status of the program
               as returned by the `wait' call.  To get the actual
               exit value divide by 256.  See also the exec entry
               elsewhere in this document.  This is not what you
               want to use to capture the output from a command,
               for that you should use merely backticks or
               `qx//', as described in the section on "`STRING`"
               in the perlop manpage.  Return value of -1
               indicates a failure to start the program (inspect
               $! for the reason).


>From Perl version 2.0:

       system LIST
               Does exactly the same thing as "exec LIST"  except
               that  a fork is done first, and the parent process
               waits for the child  process  to  complete.   Note
               that  argument  processing varies depending on the
               number of arguments.  The return value is the exit
               status  of  the  program as returned by the wait()
               call.  To get the actual exit value divide by 256.
               See also exec.


If you want to get a list of files from the current directory
use either:

opendir my $dh, '.' or die "Cannot open the current directory: $!";
my @files = grep /^bex/, readdir $dh;
closedir $dh;

Or:

my @files = glob 'bex*';



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to