metalfan has asked for the wisdom of the Perl Monks concerning the following question:
hi,
im currently using this construct to read my input:
my $formel=$ARGV[0]; my ($vorzeichen_a,$a,$vorzeichen_b,$b,$vorzeichen_c, $c) = ($formel =~ + m/y= (\+|\-|) #$vorzeichen_a + (.+|) #$a + x\^2 + (\+|\-|) #$vorzeichen_b + (.+) #$b + x + (\+|\-|) #$vorzeichen_c + (.+) #$c + $/x);
the input is in the form y=ax^2+bx+c, a,b or c arent needed every time.
if tried to check if they are used like this:
(a has to be 1 if unset)
if (defined($a)) {} else { $a=1; }
but that doesnt work, the var is always defined :(
what other options do i have?
greets
metalfan
20051224 Cleaned up by Corion: Added formatting.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: if var isnt used
by tirwhan (Abbot) on Dec 24, 2005 at 10:39 UTC | |
by metalfan (Novice) on Dec 24, 2005 at 14:26 UTC | |
by tirwhan (Abbot) on Dec 24, 2005 at 15:44 UTC | |
|
Re: if var isnt used
by holli (Abbot) on Dec 24, 2005 at 15:00 UTC | |
by metalfan (Novice) on Dec 24, 2005 at 21:15 UTC | |
|
Re: if var isnt used
by ikegami (Patriarch) on Dec 25, 2005 at 01:35 UTC | |
|
Re: if var isnt used
by secret (Beadle) on Dec 24, 2005 at 10:23 UTC | |
by Anonymous Monk on Dec 25, 2005 at 00:28 UTC | |
by mrborisguy (Hermit) on Dec 25, 2005 at 05:07 UTC |