-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Dec 5, 2008, at 11:42 AM, Jenda Krynicky wrote:
In Perl 5.10 there is a new operator // that tests the defined()ness
so there you could write
$title = $title1 // $title2 // $old_title;
and it would mean exactly what you said you need. It will s
From: Dermot <[EMAIL PROTECTED]>
> 2008/12/5 Raymond Wan <[EMAIL PROTECTED]>:
> > Maybe I have missed something, but it sounds like you want something like
> > [NB: This is not Perl code, but sort of pseudocode]:
> >
> > if (defined (title1)) {
> > $title = title1;
> > }
> > elsif (defined (title
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Dec 5, 2008, at 10:34 AM, Dermot wrote:
I was looking to test title1 and return that if it was defined else,
test title2 and return that if defined, failing that, return oldtitle.
The ? : operator won't do that. It tests title1 and if true return
2008/12/5 Raymond Wan <[EMAIL PROTECTED]>:
>
> Hi Dermot,
>
>
> Dermot wrote:
>> Sorry. Someone on the list mentioned to me before, a reference is
>> always true, so the test won't work.
>>
>
> Maybe I have missed something, but it sounds like you want something like
> [NB: This is not Perl code,
Hi Dermot,
Dermot wrote:
2008/12/5 Dermot <[EMAIL PROTECTED]>:
+---+---+++
| title1 | title2 | oldtitle
--++
| NULL | NULL | The cat jumped over the mat
I used this statement to tr
2008/12/5 Dermot <[EMAIL PROTECTED]>:
> Hi,
>
> I have some data from a dbi that looks like this:
>
> +---+---+++
> | title1 | title2 | oldtitle
> --++
> | NULL | NULL | The cat jumped over
Rob Dixon wrote:
> Dr.Ruud wrote:
>>
>> Karyn Williams schreef:
>>
>>> $initial ?
>>> $gecos = "$first $initial $last, $sid, SIR Fall 2007":
>>> $gecos = "$first $last, $sid, SIR Fall 2007";
>>
>> Variant-1:
>>
>> $gecos = $first;
>> $gecos .= " $initial
Dr.Ruud wrote:
>
Karyn Williams schreef:
$initial ?
$gecos = "$first $initial $last, $sid, SIR Fall 2007":
$gecos = "$first $last, $sid, SIR Fall 2007";
Variant-1:
$gecos = $first;
$gecos .= " $initial" if $initial;
$gecos .= " $last, $sid, SIR
Karyn Williams schreef:
> $initial ?
> $gecos = "$first $initial $last, $sid, SIR Fall 2007":
> $gecos = "$first $last, $sid, SIR Fall 2007";
Variant-1:
$gecos = $first;
$gecos .= " $initial" if $initial;
$gecos .= " $last, $sid, SIR Fall 2007";
V
At 10:04 AM 3/7/07 -0800, Tom Phoenix wrote:
>On 3/7/07, Karyn Williams <[EMAIL PROTECTED]> wrote:
>
>> if ($initial =~ "") {
>
>You probably don't want the binding operator =~ in there, but the
>string equality test eq, right? Check the perlop manpage. Good luck
>with it!
Using the eq op
At 09:58 AM 3/7/07 -0800, Karyn Williams wrote:
>At 09:35 AM 3/7/07 -0800, Tom Phoenix wrote:
>>On 3/7/07, Karyn Williams <[EMAIL PROTECTED]> wrote:
>>
>>> I have a script where I am trying to use the conditional operator.
>>> Apparently I am confused as it always evaluates false.
>>
>>> $i
On 3/7/07, Karyn Williams <[EMAIL PROTECTED]> wrote:
if ($initial =~ "") {
You probably don't want the binding operator =~ in there, but the
string equality test eq, right? Check the perlop manpage. Good luck
with it!
--Tom Phoenix
Stonehenge Perl Training
--
To unsubscribe, e-mail:
At 09:35 AM 3/7/07 -0800, Tom Phoenix wrote:
>On 3/7/07, Karyn Williams <[EMAIL PROTECTED]> wrote:
>
>> I have a script where I am trying to use the conditional operator.
>> Apparently I am confused as it always evaluates false.
>
>> $initial ?
>> $gecos = "$first $initial $
On 3/7/07, Karyn Williams <[EMAIL PROTECTED]> wrote:
I have a script where I am trying to use the conditional operator.
Apparently I am confused as it always evaluates false.
$initial ?
$gecos = "$first $initial $last, $sid, SIR Fall 2007":
$gecos = "$f
On Monday, June 3, 2002, at 10:45 AM, bob ackerman wrote:
>
> On Monday, June 3, 2002, at 10:37 AM, Jeff 'japhy' Pinyan wrote:
>
>> On Jun 3, bob ackerman said:
>>
@ARGV = "< $filename" if $opt_f;
>>>
>>> why '<' ? isn't '$filename' enough for get '<>' to open and read from
>>> that
>>
; From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 03, 2002 1:38 PM
> To: bob ackerman
> Cc: [EMAIL PROTECTED]
> Subject: Re: Conditional Operator && STDIN
>
>
> On Jun 3, bob ackerman said:
>
> >> @ARGV = "< $filen
On Monday, June 3, 2002, at 10:37 AM, Jeff 'japhy' Pinyan wrote:
> On Jun 3, bob ackerman said:
>
>>> @ARGV = "< $filename" if $opt_f;
>>
>> why '<' ? isn't '$filename' enough for get '<>' to open and read from
>> that
>> file?
>
> I feel safer when I explicitly state the mode. Unless you w
On Jun 3, bob ackerman said:
>> @ARGV = "< $filename" if $opt_f;
>
>why '<' ? isn't '$filename' enough for get '<>' to open and read from that
>file?
I feel safer when I explicitly state the mode. Unless you want the user
to put 'foo |' as the filename (that is, the output of a pipe), then y
On Monday, June 3, 2002, at 09:27 AM, Jeff 'japhy' Pinyan wrote:
> On Jun 3, Balint, Jess said:
>
>> Hello all. I am working on my script, and I would like to be able to use
>> STDIN as a filehandle input unless a filename is specified. I have used
>> the
>> getopt for the filename, let's say
On Jun 3, Balint, Jess said:
>Hello all. I am working on my script, and I would like to be able to use
>STDIN as a filehandle input unless a filename is specified. I have used the
>getopt for the filename, let's say $opt_f.
I would use the magic of @ARGV and <>, and do this:
@ARGV = "< $filen
20 matches
Mail list logo