Tuesday, June 21, 2011

Basic Vi Commands,and some perl samples.

VI;
Good link to learn vi.

http://www.cs.colostate.edu/helpdocs/vi.html

Lists all the basic commands required to edit in VI on the Cygwin
environment.

Perl :
A simple perl script:

$> vi first.pl
#!/usr/bin/perl

print "hello world";

(Embedded image moved to file: pic01821.gif)

- Save and Exit
- Give it execute permissions - chmod 755 first.pl
- Check the permissions

(Embedded image moved to file: pic19172.gif)

- Execute it
./first.pl

(Embedded image moved to file: pic07581.gif)


Similarly, try this - this prints the string 10 times

for ( 1.. 10 ) {
printf (" hello world" );
}

No comments:

Post a Comment