Complete.Org: Mailing Lists: Archives: linux-help: January 2001:
[linux-help] Re: Quick BASH/Perl Question
Home

[linux-help] Re: Quick BASH/Perl Question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: linux-help@xxxxxxxxx
Subject: [linux-help] Re: Quick BASH/Perl Question
From: Steven Saner <ssaner@xxxxxxxxxxxxxxx>
Date: Wed, 10 Jan 2001 17:33:45 -0600
Reply-to: linux-help@xxxxxxxxx

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


[Prev in Thread] Current Thread [Next in Thread]