> snip
>> $foo = $string =~ /^([^-])+-/ ? $1 : '' ;
>>
>> that will grab something from the start to the first - and grab it. if
>> it matched it will assign it to $foo, otherwise assign ''. (and '' is
>> called the null string, not null. perl has no null things unlike
>> databases).
> snip
On Fri, May 28, 2010 at 14:46, Uri Guttman wrote:
>> "CO" == Chas Owens writes:
>
> CO> On Fri, May 28, 2010 at 12:44, Uri Guttman wrote:
>
> >> the negated char class is usually faster than most similar methods. i
> >> just like it as it says what i really want - a string without any - c
> "CO" == Chas Owens writes:
CO> On Fri, May 28, 2010 at 12:44, Uri Guttman wrote:
>> the negated char class is usually faster than most similar methods. i
>> just like it as it says what i really want - a string without any - chars.
>> also anchoring helps too in saying this string
On Fri, May 28, 2010 at 12:44, Uri Guttman wrote:
>> "CO" == Chas Owens writes:
>
> CO> On Fri, May 28, 2010 at 01:05, Uri Guttman wrote:
> CO> snip
> >> $foo = $string =~ /^([^-])+-/ ? $1 : '' ;
> >>
> >> that will grab something from the start to the first - and grab it. if
>
> "CO" == Chas Owens writes:
CO> On Fri, May 28, 2010 at 01:05, Uri Guttman wrote:
CO> snip
>> $foo = $string =~ /^([^-])+-/ ? $1 : '' ;
>>
>> that will grab something from the start to the first - and grab it. if
>> it matched it will assign it to $foo, otherwise assign
On Fri, May 28, 2010 at 01:05, Uri Guttman wrote:
snip
> $foo = $string =~ /^([^-])+-/ ? $1 : '' ;
>
> that will grab something from the start to the first - and grab it. if
> it matched it will assign it to $foo, otherwise assign ''. (and '' is
> called the null string, not null. perl has
> "G" == Grant writes:
G> The value of $string could include dashes or not. If it is, I'd like
G> the value of $foo to be set to the portion of the string to the left
G> of the first dash. If not, I'd like the value of $foo to be null.
G> I'm doing the following, but $foo is equal
The value of $string could include dashes or not. If it is, I'd like
the value of $foo to be set to the portion of the string to the left
of the first dash. If not, I'd like the value of $foo to be null.
I'm doing the following, but $foo is equal to "1" if there are no
dashes in the string:
$fo