Re: output in a single line



On 5/25/05, Manav Mathur wrote:
>
> our $rupee = <STDIN>;
> chomp($rupee) ;

Vineet,
This is a quote from "perldoc perlop":
"In scalar context, evaluating a filehandle in angle brackets yields
the next line from that file (the newline, if any, included),"
Manav's solution involves removing the newline using chomp. You can
also write this in one line if you want (read "perldoc -f chomp" for
details):
chomp(our $rupee = <STDIN>);

Finally and unrelated, unless you have a very good reason to make
$rupee and $rupee_c1 global, I would change the declaration to "my"
instead of "our". Don't use globals without a good reason, it's a bad
habit :-)

Cheers,
--
Offer Kaye
.



Relevant Pages

  • RE: Declarations variables, Dim, some guidance please
    ... Good coding practice is to use global or module level variable declarations ... The big reason is that it makes the code very ... The only reasons that I ever use Globals are: ... > the macro I was testing. ...
    (microsoft.public.excel.programming)
  • Re: Declarations variables, Dim, some guidance please
    ... or maybe a collection class. ... The big reason is that it makes the code very ... The only reasons that I ever use Globals ... >>> those vars that are used quite often in many macros within the sub ...
    (microsoft.public.excel.programming)
  • Re: Declarations variables, Dim, some guidance please
    ... The big reason is that it makes the code very ... The only reasons that I ever use Globals are: ... I have a function or sub procedure that is called repeatedly (great for ... >> the macro I was testing. ...
    (microsoft.public.excel.programming)
  • Re: Helper Methods
    ... I sometimes find it helpful to write private ... which in turn calls several private helper methods. ... Hmm, well no reason really, now that you mention it. ... nothing wrong with globals in that case, ...
    (comp.object)
  • Re: Helper Methods
    ... I sometimes find it helpful to write private ... which in turn calls several private helper methods. ... Hmm, well no reason really, now that you mention it. ... nothing wrong with globals in that case, ...
    (comp.object)