List Info

Thread: sort




sort
country flaguser name
United States
2008-03-07 20:52:44

hello, if this group is still alive.
i have code to sort items in a directory (below). i'd like to be able
to show only files that start with an 'r'. thanks in advance for your
help. let me know if you know of a better place to post.
opendir(STOCKBACKGROUND, ".") || &error("STOCKBACKGROUND");
stockbackgrounds = readdir(STOCKBACKGROUND);
stockbackgrounds = sort {lc($a) cmp lc($b)} stockbackgrounds;
closedir(STOCKBACKGROUND);

__._,_.___
.

__,_._,___
Re: sort
country flaguser name
United States
2008-03-24 13:47:38

It appears to mostly be dead. I think I'll be unsubscribing shortly.
I don't know of a better place for general perl questions though.

stockbackgrounds = grep /^r/, readdir(STOCKBACKGROUND)

should do the trick. The grep limits it to filenames that begin with r.

On Fri, Mar 7, 2008 at 9:52 PM, Fred Garvin < ahqmed%40hotmail.com">ahqmedhotmail.com> wrote:
&gt;
> hello, if this group is still alive.
&gt; i have code to sort items in a directory (below). i'd like to be able
>; to show only files that start with an 'r'. thanks in advance for your
>; help. let me know if you know of a better place to post.
&gt; opendir(STOCKBACKGROUND, ".&quot;) || &error("STOCKBACKGROUND");
> stockbackgrounds = readdir(STOCKBACKGROUND);
>; stockbackgrounds = sort {lc($a) cmp lc($b)} stockbackgrounds;
&gt; closedir(STOCKBACKGROUND);
&gt;
>

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )