$# is deprecated, $OFMT doesn't work

Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

    Default $# is deprecated, $OFMT doesn't work

    $ perl -wle '$#="%.2f";print 1/3'
    Use of $# is deprecated at -e line 1.
    0.33
    $ man perlvar
    $ perl -wle '$OFMT="%.2f";print 1/3'
    Name "main::OFMT" used only once: possible typo at -e line 1.
    0.333333333333333

    What is the matter with me?
    perl, v5.8.0
    Dan Jacobson Guest

  2. Similar Questions and Discussions

    1. Deprecated Code??
      HI TEAM!!! Is there a way to simplify this code/? Is setProperty and getProperty deprecated as of MX 2004? ti = 20; for (n=0; n<ti; n++) {...
    2. deprecated
      " In scalar context, returns the number of fields found and splits into the "@_" array. Use of split in scalar context is deprecated, however,...
    3. Is -w deprecated?
      In the book I bought, Programming Perl, by O'Reilly they say I should use warnings instead of -w after the shebang and the perl path because -w is...
    4. deprecated function list?
      Hi list, I've a problem with the mime_content_type function. each time I use them, my script bug but in my php.ini the extension...
    5. hex is deprecated?
      hex isn't deprecated, but bgcolor is. You should be using styles for that. It is soooo much easier than doing it in your html. Why resist?? --...
  3. #2

    Default Re: $# is deprecated, $OFMT doesn't work

    On Wed, 10 Sep 2003 12:23:58 +0800
    Dan Jacobson <jidanni@jidanni.org> wrote:
    > $ perl -wle '$#="%.2f";print 1/3'
    > Use of $# is deprecated at -e line 1.
    > 0.33
    > $ man perlvar
    > $ perl -wle '$OFMT="%.2f";print 1/3'
    > Name "main::OFMT" used only once: possible typo at -e line 1.
    > 0.333333333333333
    >
    > What is the matter with me?
    > perl, v5.8.0
    Why not just use printf?

    jim@maxine:~> perl -wle 'printf "%.2f\n", 1/3'
    0.33
    jim@maxine:~>

    HTH

    --
    Jim

    Copyright notice: all code written by the author in this post is
    released under the GPL. [url]http://www.gnu.org/licenses/gpl.txt[/url]
    for more information.

    a fortune quote ...
    Life is like a simile.

    James Willmore Guest

  4. #3

    Default Re: $# is deprecated, $OFMT doesn't work

    Dan Jacobson <jidanni@jidanni.org> wrote:
    > $ perl -wle '$OFMT="%.2f";print 1/3'
    > Name "main::OFMT" used only once: possible typo at -e line 1.
    > 0.333333333333333
    Note to OP: in perlvar it should tell you that to use the long names of
    the punctuation variables you need to:

    use English;

    But since $# is deprecated, see printf instead.


    Question to everyone:

    Should perlvar in 5.8.0 still mention $OFMT when it has been removed
    from English.pm?

    I don't know how to submit a documentation patch to p5p, but I suppose I
    can learn.

    Steve
    Steven Smolinski Guest

  5. #4

    Default Re: $# is deprecated, $OFMT doesn't work

    Also sprach Dan Jacobson:
    > $ perl -wle '$#="%.2f";print 1/3'
    > Use of $# is deprecated at -e line 1.
    > 0.33
    > $ man perlvar
    > $ perl -wle '$OFMT="%.2f";print 1/3'
    > Name "main::OFMT" used only once: possible typo at -e line 1.
    > 0.333333333333333
    If you want to use the long variable names for the punctuation
    variables, you need the English module. However, $OFMT isn't handled by
    that because $# is deprecated. Therefore:

    *OFMT = \$#;
    $OFMT = "%.2f\n";
    print 1/3;
    __END__
    0.33

    The first line will make $OFMT an alias for $#.

    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$&."'!#+sexisexi ixesixeseg;y~\n~~dddd;eval
    Tassilo v. Parseval Guest

  6. #5

    Default Re: $# is deprecated, $OFMT doesn't work

    Also sprach Steven Smolinski:
    > Dan Jacobson <jidanni@jidanni.org> wrote:
    >> $ perl -wle '$OFMT="%.2f";print 1/3'
    >> Name "main::OFMT" used only once: possible typo at -e line 1.
    >> 0.333333333333333
    >
    > Note to OP: in perlvar it should tell you that to use the long names of
    > the punctuation variables you need to:
    >
    > use English;
    >
    > But since $# is deprecated, see printf instead.
    >
    >
    > Question to everyone:
    >
    > Should perlvar in 5.8.0 still mention $OFMT when it has been removed
    > from English.pm?
    I just wondered about that, too, when I saw that alias to the deprecated
    variables are commented out in English.pm. Either perlvar removes the
    symbolic name of deprecated variables or the aliases remain in
    English.
    > I don't know how to submit a documentation patch to p5p, but I suppose I
    > can learn.
    perlvar.pod is just a plain file in the Perl source tree so you'd patch
    it as any other file. See 'perldoc perlhack' for an instruction on how
    to patch Perl and submit those patches.

    Essentially: rsync one of the branches (blead, aka 5.9.0 or maint
    [5.8.1-to-come]), cp pod/perlvar.pod to pod/perlvar.pod~ or so, patch
    perlvar.pod, run

    diff -u pod/perlvar.pod~ pod/perlvar.pod > patch

    and send the patch as attachment to [email]perl5-porters@perl.org[/email] while
    mentioning against which branch this patch is (althouth the porters
    might figure that out themselves).

    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$&."'!#+sexisexi ixesixeseg;y~\n~~dddd;eval
    Tassilo v. Parseval Guest

  7. #6

    Default Re: $# is deprecated, $OFMT doesn't work

    Steven Smolinski (steven.smolinski@sympatico.ca) wrote on MMMDCLXII
    September MCMXCIII in <URL:news:2fz7b.3002$z5.237577@news20.bellglobal.c om>:
    )) Dan Jacobson <jidanni@jidanni.org> wrote:
    )) > $ perl -wle '$OFMT="%.2f";print 1/3'
    )) > Name "main::OFMT" used only once: possible typo at -e line 1.
    )) > 0.333333333333333
    ))
    )) Note to OP: in perlvar it should tell you that to use the long names of
    )) the punctuation variables you need to:
    ))
    )) use English;
    ))
    )) But since $# is deprecated, see printf instead.
    ))
    ))
    )) Question to everyone:
    ))
    )) Should perlvar in 5.8.0 still mention $OFMT when it has been removed
    )) from English.pm?
    ))
    )) I don't know how to submit a documentation patch to p5p, but I suppose I
    )) can learn.


    I've submitted a patch. Note that in the 5.8.1 track the OFMT
    equivalent for $# was already removed from perlvar.



    Abigail
    --
    ($;,$_,$|,$\)=("\@\x7Fy~*kde~box*Zoxf*Bkiaox"," "x25,1,"\r");
    {vec($_=>1+$"=>$^F<<$^F)=ord($/^substr$;=>$"=int rand 24=>1);
    print&&select$,,$,,$,,$|/($|+tr/ //c);redo if y/ //>$^F**2};
    Abigail Guest

  8. #7

    Default Re: $# is deprecated, $OFMT doesn't work

    Also sprach Abigail:
    > Steven Smolinski (steven.smolinski@sympatico.ca) wrote on MMMDCLXII
    > September MCMXCIII in <URL:news:2fz7b.3002$z5.237577@news20.bellglobal.c om>:
    > )) Question to everyone:
    > ))
    > )) Should perlvar in 5.8.0 still mention $OFMT when it has been removed
    > )) from English.pm?
    > ))
    > )) I don't know how to submit a documentation patch to p5p, but I suppose I
    > )) can learn.
    >
    >
    > I've submitted a patch. Note that in the 5.8.1 track the OFMT
    > equivalent for $# was already removed from perlvar.
    Hmmh, was it? I get (for RC1 though):

    ethan@ethan:~$ perldoc5.8.1 -t perlvar | grep -A1 -m1 OFMT
    $OFMT
    $# The output format for printed numbers. This variable is a

    Even in my not-so-lang-ago-synced blead perlvar.pod still mentions it.

    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$&."'!#+sexisexi ixesixeseg;y~\n~~dddd;eval
    Tassilo v. Parseval Guest

  9. #8

    Default Re: $# is deprecated, $OFMT doesn't work

    Tassilo v. Parseval (tassilo.parseval@rwth-aachen.de) wrote on MMMDCLXII
    September MCMXCIII in <URL:news:bjmmt8$gln$1@nets3.rz.RWTH-Aachen.DE>:
    "" Also sprach Abigail:
    ""
    "" > Steven Smolinski (steven.smolinski@sympatico.ca) wrote on MMMDCLXII
    "" > September MCMXCIII in <URL:news:2fz7b.3002$z5.237577@news20.bellglobal.c om>:
    ""
    "" > )) Question to everyone:
    "" > ))
    "" > )) Should perlvar in 5.8.0 still mention $OFMT when it has been removed
    "" > )) from English.pm?
    "" > ))
    "" > )) I don't know how to submit a documentation patch to p5p, but I suppose I
    "" > )) can learn.
    "" >
    "" >
    "" > I've submitted a patch. Note that in the 5.8.1 track the OFMT
    "" > equivalent for $# was already removed from perlvar.
    ""
    "" Hmmh, was it? I get (for RC1 though):
    ""
    "" ethan@ethan:~$ perldoc5.8.1 -t perlvar | grep -A1 -m1 OFMT
    "" $OFMT
    "" $# The output format for printed numbers. This variable is a
    ""
    "" Even in my not-so-lang-ago-synced blead perlvar.pod still mentions it.


    You are right. After submitting the patch, I grepped for OFMT as well,
    but grepped against the patched file.



    Abigail
    --
    perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
    Abigail Guest

  10. #9

    Default Re: $# is deprecated, $OFMT doesn't work

    Also sprach Abigail:
    > Tassilo v. Parseval (tassilo.parseval@rwth-aachen.de) wrote on MMMDCLXII
    > September MCMXCIII in <URL:news:bjmmt8$gln$1@nets3.rz.RWTH-Aachen.DE>:
    > "" Also sprach Abigail:
    > "" > I've submitted a patch. Note that in the 5.8.1 track the OFMT
    > "" > equivalent for $# was already removed from perlvar.
    > ""
    > "" Hmmh, was it? I get (for RC1 though):
    > ""
    > "" ethan@ethan:~$ perldoc5.8.1 -t perlvar | grep -A1 -m1 OFMT
    > "" $OFMT
    > "" $# The output format for printed numbers. This variable is a
    > ""
    > "" Even in my not-so-lang-ago-synced blead perlvar.pod still mentions it.
    >
    >
    > You are right. After submitting the patch, I grepped for OFMT as well,
    > but grepped against the patched file.
    Haha, you first removed those occurances and immediately after that
    checked whether they had been there at all in the first place? ;-)

    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$&."'!#+sexisexi ixesixeseg;y~\n~~dddd;eval
    Tassilo v. Parseval Guest

  11. #10

    Default Re: $# is deprecated, $OFMT doesn't work

    Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote in comp.lang.perl.misc:

    [how to prepare a perl patch]
    > diff -u pod/perlvar.pod~ pod/perlvar.pod > patch
    >
    > and send the patch as attachment to [email]perl5-porters@perl.org[/email] while
    Minor correction: Simply append the patch to the mail. Sending it
    as an attachment actually makes it harder for the receiver, since
    the patch program can deal directly with a mail message that ends
    with a patch.

    Anno
    Anno Siegel Guest

  12. #11

    Default Re: $# is deprecated, $OFMT doesn't work

    Tassilo v. Parseval (tassilo.parseval@rwth-aachen.de) wrote on MMMDCLXII
    September MCMXCIII in <URL:news:bjmoid$ie4$1@nets3.rz.RWTH-Aachen.DE>:
    }} Also sprach Abigail:
    }}
    }} > Tassilo v. Parseval (tassilo.parseval@rwth-aachen.de) wrote on MMMDCLXII
    }} > September MCMXCIII in <URL:news:bjmmt8$gln$1@nets3.rz.RWTH-Aachen.DE>:
    }} > "" Also sprach Abigail:
    }}
    }} > "" > I've submitted a patch. Note that in the 5.8.1 track the OFMT
    }} > "" > equivalent for $# was already removed from perlvar.
    }} > ""
    }} > "" Hmmh, was it? I get (for RC1 though):
    }} > ""
    }} > "" ethan@ethan:~$ perldoc5.8.1 -t perlvar | grep -A1 -m1 OFMT
    }} > "" $OFMT
    }} > "" $# The output format for printed numbers. This variable is
    }} > ""
    }} > "" Even in my not-so-lang-ago-synced blead perlvar.pod still mentions it.
    }} >
    }} >
    }} > You are right. After submitting the patch, I grepped for OFMT as well,
    }} > but grepped against the patched file.
    }}
    }} Haha, you first removed those occurances and immediately after that
    }} checked whether they had been there at all in the first place? ;-)


    Yeah, because in English.pm there were 4 variables outcommented, and
    only two of them were still mentioned in perlvar. And I've an attention
    span of approx. 0.2 seconds, so I forgot which ones were already
    removed.


    Abigail
    --
    perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
    ..qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
    ..qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
    %$^U;$^V/=$^U}while$^V!=$^W'
    Abigail Guest

  13. #12

    Default Re: $# is deprecated, $OFMT doesn't work

    Also sprach Anno Siegel:
    > Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote in comp.lang.perl.misc:
    >
    > [how to prepare a perl patch]
    >
    >> diff -u pod/perlvar.pod~ pod/perlvar.pod > patch
    >>
    >> and send the patch as attachment to [email]perl5-porters@perl.org[/email] while
    >
    > Minor correction: Simply append the patch to the mail. Sending it
    > as an attachment actually makes it harder for the receiver, since
    > the patch program can deal directly with a mail message that ends
    > with a patch.
    That might be the best solution assuming you have a decent mailer. The
    indecent ones are likely to render the patch unsubmittable by
    introducing bogus line-breaks or such. Porting/patching.pod states:

    Submitting your patch
    Mailers
    Please, please, please (get the point? 8-) don't use a mailer that
    word wraps your patch. This leaves the patch essentially worthless
    to the maintainers.

    Unfortunately many mailers word wrap the main text of messages, but
    luckily you can usually send your patches as email attachments
    without them getting "helpfully" word wrapped.

    I don't think my MUA is one of the evil ones, but the above somehow made
    me cautious enough to always use attachments. I am a careful person. :-)

    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$&."'!#+sexisexi ixesixeseg;y~\n~~dddd;eval
    Tassilo v. Parseval Guest

  14. #13

    Default Re: $# is deprecated, $OFMT doesn't work

    Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote in comp.lang.perl.misc:
    > Also sprach Anno Siegel:
    >
    > > Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote in
    > comp.lang.perl.misc:
    > >
    > > [how to prepare a perl patch]
    > >
    > >> diff -u pod/perlvar.pod~ pod/perlvar.pod > patch
    > >>
    > >> and send the patch as attachment to [email]perl5-porters@perl.org[/email] while
    > >
    > > Minor correction: Simply append the patch to the mail. Sending it
    > > as an attachment actually makes it harder for the receiver, since
    > > the patch program can deal directly with a mail message that ends
    > > with a patch.
    >
    > That might be the best solution assuming you have a decent mailer. The
    > indecent ones are likely to render the patch unsubmittable by
    > introducing bogus line-breaks or such. Porting/patching.pod states:
    That is indeed another aspect. Don't patch sources with long lines :)
    > Submitting your patch
    > Mailers
    > Please, please, please (get the point? 8-) don't use a mailer that
    > word wraps your patch. This leaves the patch essentially worthless
    > to the maintainers.
    >
    > Unfortunately many mailers word wrap the main text of messages, but
    > luckily you can usually send your patches as email attachments
    > without them getting "helpfully" word wrapped.
    >
    > I don't think my MUA is one of the evil ones, but the above somehow made
    > me cautious enough to always use attachments. I am a careful person. :-)
    I did that too (send attachments), until someone (Hugo?) asked me not to.

    When sending a patch from somewhere I haven't done it before, I mail it
    to myself and see if it arrives in good shape.

    Anno
    Anno Siegel Guest

  15. #14

    Default Re: $# is deprecated, $OFMT doesn't work

    Tassilo v. Parseval <tassilo.parseval@rwth-aachen.de> wrote:
    > Also sprach Steven Smolinski:
    >> I don't know how to submit a documentation patch to p5p, but I
    >> suppose I can learn.
    >
    > perlvar.pod is just a plain file in the Perl source tree so you'd patch
    > it as any other file. See 'perldoc perlhack' for an instruction on how
    > to patch Perl and submit those patches.
    > [...]
    Thanks for the primer. Next time I won't let Abigail beat me to it.

    Steve
    --
    Steven Smolinski => [url]http://arbiter.ca/[/url]
    GnuPG Public Key => [url]http://arbiter.ca/steves_public_key.txt[/url]
    => or email me with 'auto-key' in the subject.
    Key Fingerprint => 08C8 6481 3A7B 2A1C 7C26 A5FC 1A1B 66AB F637 495D
    Steven Smolinski Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139