Help me beef up my cruddy program

Discussion in 'Perl Misc' started by Dan Jacobson, Sep 10, 2003.

  1. Dan Jacobson

    Dan Jacobson Guest

    Help me beef up my cruddy program. It should then even run on Microsoft,
    by the way.

    #!/usr/bin/perl -ws
    #use strict; #can't use due to -s.
    $, = "\t";
    $\ = "\n";
    my $A = 0.00001549;
    my $B = 0.000006521;
    my $C = 807.8;
    my $D = 248.6;
    if ( $I ) {
    foreach my $i ( $A, $B, $C, $D ) { $i = -$i }
    }
    while (<>) {
    my @F = split;
    print $F[0] - $C - $A * $F[0] - $B * $F[1],
    $F[1] + $D - $A * $F[1] - $B * $F[0], "@F";
    }
     
    Dan Jacobson, Sep 10, 2003
    #1
    1. Advertising

  2. Dan Jacobson

    Uri Guttman Guest

    >>>>> "DJ" == Dan Jacobson <> writes:

    DJ> Help me beef up my cruddy program. It should then even run on Microsoft,
    DJ> by the way.

    DJ> #!/usr/bin/perl -ws
    DJ> #use strict; #can't use due to -s.

    wrong. use vars or our can fix that.

    DJ> $, = "\t";
    DJ> $\ = "\n";
    DJ> my $A = 0.00001549;
    DJ> my $B = 0.000006521;
    DJ> my $C = 807.8;
    DJ> my $D = 248.6;
    DJ> if ( $I ) {
    DJ> foreach my $i ( $A, $B, $C, $D ) { $i = -$i }
    DJ> }
    DJ> while (<>) {
    DJ> my @F = split;
    DJ> print $F[0] - $C - $A * $F[0] - $B * $F[1],
    DJ> $F[1] + $D - $A * $F[1] - $B * $F[0], "@F";
    DJ> }

    if you picked better var names and decribed what this is supposed to do,
    someone might help. i won't waste my time on the above.

    uri

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
    Damian Conway Class in Boston - Sept 2003 -- http://www.stemsystems.com/class
     
    Uri Guttman, Sep 10, 2003
    #2
    1. Advertising

  3. Dan Jacobson

    Uri Guttman Guest

    >>>>> "DJ" == Dan Jacobson <> writes:

    DJ> Help me beef up my cruddy program. It should then even run on Microsoft,
    DJ> by the way.

    DJ> #!/usr/bin/perl -ws
    DJ> #use strict; #can't use due to -s.

    wrong. use vars or our can fix that.

    DJ> $, = "\t";
    DJ> $\ = "\n";
    DJ> my $A = 0.00001549;
    DJ> my $B = 0.000006521;
    DJ> my $C = 807.8;
    DJ> my $D = 248.6;
    DJ> if ( $I ) {
    DJ> foreach my $i ( $A, $B, $C, $D ) { $i = -$i }
    DJ> }
    DJ> while (<>) {
    DJ> my @F = split;
    DJ> print $F[0] - $C - $A * $F[0] - $B * $F[1],
    DJ> $F[1] + $D - $A * $F[1] - $B * $F[0], "@F";
    DJ> }

    if you picked better var names and decribed what this is supposed to do,
    someone might help. i won't waste my time on the above.

    uri

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
    Damian Conway Class in Boston - Sept 2003 -- http://www.stemsystems.com/class
     
    Uri Guttman, Sep 10, 2003
    #3
  4. Dan Jacobson <> wrote in
    news::

    > Help me beef up my cruddy program. It should then even run on Microsoft,
    > by the way.


    What's wrong with it?

    --
    Eric
    $_ = reverse sort $ /. r , qw p ekca lre uJ reh
    ts p , map $ _. $ " , qw e p h tona e and print
     
    Eric J. Roode, Sep 10, 2003
    #4
  5. Dan Jacobson

    Helgi Briem Guest

    On Wed, 10 Sep 2003 10:12:45 +0000 (UTC), "Bernard El-Hagin"
    <bernard.el-hagin@DODGE_THISlido-tech.net> wrote:

    >Eric J. Roode wrote:
    >
    >> Dan Jacobson <> wrote in
    >> news::
    >>
    >>> Help me beef up my cruddy program. It should then even run on
    >>> Microsoft, by the way.

    >>
    >> What's wrong with it?

    >
    >
    >It's lacking in beef, according to the Subject.


    $beef++;
     
    Helgi Briem, Sep 10, 2003
    #5
  6. Dan Jacobson

    Bob Dover Guest

    "Helgi Briem" wrote...
    > "Bernard El-Hagin" wrote:
    > >Eric J. Roode wrote:
    > >> What's wrong with it?

    > >It's lacking in beef, according to the Subject.

    > $beef++;


    Chuckle... Thanks, I needed that!
     
    Bob Dover, Sep 10, 2003
    #6
  7. Dan Jacobson wrote:
    > Help me beef up my cruddy program. It should then even run on
    > Microsoft, by the way.
    >
    > #!/usr/bin/perl -ws
    > #use strict; #can't use due to -s.
    > $, = "\t";
    > $\ = "\n";


    What is this supposed to do?

    > my $A = 0.00001549;
    > my $B = 0.000006521;
    > my $C = 807.8;
    > my $D = 248.6;


    By convention people use upper case variables for file descriptions only.

    > if ( $I ) {
    > foreach my $i ( $A, $B, $C, $D ) { $i = -$i }
    > }


    Why the condition? The body will never be executed because $I will never be
    true.
    Didn't perl warn you about undefined value?

    > while (<>) {
    > my @F = split;
    > print $F[0] - $C - $A * $F[0] - $B * $F[1],
    > $F[1] + $D - $A * $F[1] - $B * $F[0], "@F";
    > }


    And what is this supposed to do versus what does it do?
    You naming convention is ---shall we say--- suboptimal?

    jue
     
    Jürgen Exner, Sep 10, 2003
    #7
  8. Dan Jacobson

    Uri Guttman Guest

    >>>>> "JE" == Jürgen Exner <> writes:

    >> #!/usr/bin/perl -ws
    >> #use strict; #can't use due to -s.


    >> if ( $I ) {
    >> foreach my $i ( $A, $B, $C, $D ) { $i = -$i }
    >> }


    JE> Why the condition? The body will never be executed because $I will
    JE> never be true. Didn't perl warn you about undefined value?

    conditional tests don't warn on undef. and his comment on strict and -s
    tells me he was passing -I on the command line and -s would then set $I
    which would negate the 4 values.

    >> while (<>) {
    >> my @F = split;
    >> print $F[0] - $C - $A * $F[0] - $B * $F[1],
    >> $F[1] + $D - $A * $F[1] - $B * $F[0], "@F";
    >> }


    JE> And what is this supposed to do versus what does it do?
    JE> You naming convention is ---shall we say--- suboptimal?

    and he still hasn't responded so i guess a hit and run troll. notice his
    other post which made some useless comment on sub locations.

    uri

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
    Damian Conway Class in Boston - Sept 2003 -- http://www.stemsystems.com/class
     
    Uri Guttman, Sep 10, 2003
    #8
  9. Also sprach Uri Guttman:

    >>>>>> "JE" == Jürgen Exner <> writes:


    > >> while (<>) {
    > >> my @F = split;
    > >> print $F[0] - $C - $A * $F[0] - $B * $F[1],
    > >> $F[1] + $D - $A * $F[1] - $B * $F[0], "@F";
    > >> }

    >
    > JE> And what is this supposed to do versus what does it do?
    > JE> You naming convention is ---shall we say--- suboptimal?
    >
    > and he still hasn't responded so i guess a hit and run troll. notice his
    > other post which made some useless comment on sub locations.


    It was a question about where to place subroutine-definitions. Looking
    at other languages (where the place of the definition could matter; for
    Perl it even does matter when using prototypes), it wasn't quite so
    useless.

    Tassilo
    --
    $_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
    pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
    $_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
     
    Tassilo v. Parseval, Sep 10, 2003
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. pipi
    Replies:
    1
    Views:
    626
    Joseph Millar
    Jul 21, 2003
  2. Rey
    Replies:
    4
    Views:
    10,998
    Roedy Green
    Dec 12, 2003
  3. ola
    Replies:
    3
    Views:
    719
    Marco Schmidt
    Feb 16, 2004
  4. Replies:
    1
    Views:
    485
    Walter Roberson
    Aug 12, 2005
  5. Kris Stark
    Replies:
    1
    Views:
    104
    John Bokma
    Sep 8, 2005
Loading...

Share This Page