[Omaha.pm] explode gt split

Jay Hannah jay at jays.net
Mon Jun 23 11:02:18 PDT 2008


On Jun 23, 2008, at 10:58 AM, Andy Lester wrote:
> On Jun 23, 2008, at 10:55 AM, Jay Hannah wrote:
>> <?php
>>     $expFileNames  = `ls -t output/`;
>>     $expFileNames  = explode("\n",$expFileNames);
>> ?>
>
> Too bad you can't just get a list anyway, like in Perl:
>
> $file_list_as_string = `ls -t output/`;
>
> @file_list           = `ls -t output/`;
>
> Might as well just go directly to the array, eh?

Ya. But in Perl you got me hooked on glob(), which is even more  
convenient:

    my @files = glob("output/*.txt");

    :)

j



More information about the Omaha-pm mailing list