[linux-help] Re: Quick BASH/Perl Question
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Thanks! Works great.
--- Steven Saner <ssaner@xxxxxxxxxxxxxxx> wrote:
>
> Since John answered the first question, I will
> answer the second.
>
> There are a couple ways. Assume that the string is
> in $str and you
> want the first letter in $val.
>
> $str =~ m/^(.)/;
> $val = $1;
>
> or
>
> $val = substr($str, 0, 1);
>
> Might be more ways too
>
>
>
> On Wed, Jan 10, 2001 at 03:03:12PM -0800, Curtis
> Hawthorne wrote:
> >
> > First, in BASH, how do I test for the presence of
> any
> > .log (*.log) file in a directory? If I do "test
> -a
> > *.log" it says there's too many arguments.
> >
> > Second, in Perl what's the easiset way to grab the
> > first letter of a string, preferably without
> splitting
> > the whole thing into a letter by letter array?
> >
> > Thanks!
> >
> > Curtis
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Photos - Share your holiday photos online!
> > http://photos.yahoo.com/
> >
> > -- This is the linux-help@xxxxxxxxx list. To
> unsubscribe,
> > visit
>
http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
>
> -- This is the linux-help@xxxxxxxxx list. To
> unsubscribe,
> visit
>
http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
>
__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/
-- This is the linux-help@xxxxxxxxx list. To unsubscribe,
visit http://tmp2.complete.org/cgi-bin/listargate-aclug.cgi
|
|