comments

comments

Post by Atul Bhingard » Wed, 16 Sep 1998 04:00:00



With proper definition of input and output file probabaly I can suggest some way
!!

Could you please be specific on the input and output file ?

Atul


> I've been looking around the web for an answer, but I can't seem to find one
> I was wondering how do you put comments in your code for a program?  For
> example, I have a code like

> 1 #!/usr/local/bin/perl
> 2 print "do this";
> 3 print "do that";
> 4 print "stop";
> 5 while { $x < 5)
> 6 {
> 7   print "$x\n";
> 8 }

> Now, if I want to comment my perl code, I could do something like this in vi
> :5,8s/^./#/
> but that would erase the first character of each line if I don't have
> any indentation.  Any ideas on how I can do this?  I guess removing it
> would be easy

> -----------------------------------------------------------------
> Tri Tram, Computer Science and Engineering at UCLA
> http://www.seas.ucla.edu/~tram

  abhingar.vcf
< 1K Download
 
 
 

comments

Post by Tri Tr » Thu, 17 Sep 1998 04:00:00


I've been looking around the web for an answer, but I can't seem to find one
I was wondering how do you put comments in your code for a program?  For
example, I have a code like

1 #!/usr/local/bin/perl
2 print "do this";
3 print "do that";
4 print "stop";
5 while { $x < 5)
6 {
7   print "$x\n";
8 }

Now, if I want to comment my perl code, I could do something like this in vi
:5,8s/^./#/
but that would erase the first character of each line if I don't have
any indentation.  Any ideas on how I can do this?  I guess removing it
would be easy

-----------------------------------------------------------------
Tri Tram, Computer Science and Engineering at UCLA
http://www.seas.ucla.edu/~tram

 
 
 

comments

Post by Mark Reuvekam » Thu, 17 Sep 1998 04:00:00



> I've been looking around the web for an answer, but I can't seem to find one
> I was wondering how do you put comments in your code for a program?  For
> example, I have a code like

> 1 #!/usr/local/bin/perl
> 2 print "do this";
> 3 print "do that";
> 4 print "stop";
> 5 while { $x < 5)
> 6 {
> 7   print "$x\n";
> 8 }

> Now, if I want to comment my perl code, I could do something like this in vi
> :5,8s/^./#/
> but that would erase the first character of each line if I don't have
> any indentation.  Any ideas on how I can do this?  I guess removing it
> would be easy

Try

:5,8s/^/#/> (leave out the dot in your example)

This will INSERT a '#' at the beginning of the line, not overwrite any
characters.

Mark

--

Unify Software Benelux b.v.
PO Box 752, 2900 AT Capelle a/d IJssel, The Netherlands.
-------------------- MuZ Skorpion Sport 660 --------------------

 
 
 

comments

Post by Michael P. Reill » Thu, 17 Sep 1998 04:00:00


: I've been looking around the web for an answer, but I can't seem to find one
: I was wondering how do you put comments in your code for a program?  For
: example, I have a code like

: 1 #!/usr/local/bin/perl
: 2 print "do this";
: 3 print "do that";
: 4 print "stop";
: 5 while { $x < 5)
: 6 {
: 7   print "$x\n";
: 8 }

: Now, if I want to comment my perl code, I could do something like this in vi
: :5,8s/^./#/
: but that would erase the first character of each line if I don't have
: any indentation.  Any ideas on how I can do this?  I guess removing it
: would be easy

You want to put an "&" in the replacement string; it evaluates to the
string that was matched: 5,8s/^./#&/ .  Does anyone know of a version
of ex/vi that doesn't have the ampersand?

If you don't care about the blank lines having the comment character
either, then you can just use: 5,8s/^/#/ .

        Arcege

 
 
 

1. Comments within commented text?

   Is there any way to comment out a bunch of lines, that may
contain other comments?  I have regularly done this in other
languages for debug and test purposes. I am certain 'C' must
have a way of doing this.

I have tried:
/*
  .....          /* Comment 1    */
  .........      /* Comment 2    */
  ........       /* Comment 3    */
*/
and get all kinds of error messages.

   I am using the "gcc" compiler on a Sun Sparc machine.

   Many thanks for your help..

Kurt

--
Kurt Meyers                                     Rockville, MD. 20854

2. crypt source code

3. comment

4. ipchains on a single machine?

5. Linus's Comments

6. How to check HACMP

7. comment typo for generic_make_request in 2.5.1-pre2?

8. WindowX

9. Comments on fbgen.c and fbcon-accel.c

10. Comment out a line in /etc/passwd & /etc/shadow

11. Comments on Using Apache on Windows95

12. Disk System Programming Idea -- comments needed

13. How to comment #!/bin/csh