Wednesday, October 17, 2007

Leaking Water Before Period

All journals

With o_O_o here you have all the numbers HackxCrack security magazine in PDF. Originally published in
ElHacker Forum. In the thread you also have the links to download por rapidshare.

ed2k://
ed2k://
ed2k://
ed2k: / /

Hello World Script



start with the program starting with 90% of Perl programmers, the "
Hello World!
." The idea is simple: make print that phrase on the screen.
In this program we use an integrated feature called

print (), which sends output to a specific location. In this case such location is the standard output

(STDOUT

), ie the screen.

To start take the template and fill it with our information such as name, version, date, author and description. Once you have that will save the file as
Hello.pl
. This is a very simple, containing only one line of code.

# / usr / bin / perl-w




#--------------------

# Script Name: Hello.pl


# Script Version: 1.0
# Date: 26.08.2007
# Author: goblin
# Description: Prints "Hello World!"
screen # Revision History:

# 1.0 /
: original version
#--------------------
print " Hello World \\ n ";
In future articles will explain the character
\\ n , along with others like him. Represents a line break character and makes the cursor is placed in the following line to run the program. To find the difference tested with and without it.
Now, to run the program, we must do the following:

UNIX : First of all we must make the file executable. This is done with chmod 755 Hello.pl
or chmod + x Hello.pl
. For more information on chmod type man chmod . Now we can run with
. / Hello.pl . Windows



: perl Hello.pl Mac OS : Drag the file and drop Hello.pl
MacPerl the icon, then select Run Hello.pl
from the Script menu. Those
    you program in other languages \u200b\u200bmay have noticed that we do not use parentheses () with the "print ()." In Perl you can use or not, our choice.
  • Now that we have our first program we will modify it a little more interesting. We will make a script that we asked for the name, process the response and return a result to the screen. In this case we use a new feature called chomp (), which removes a newline at the end of a string. By accepting input from the command line, the (character) return to the user pressed is also stored in the string. Using chomp, we remove this extra newline character and focus solely on alphanumeric data input.
  • Perl also has a feature called
  • chop () that removes the last character of a string. Unlike
  • chomp ()
  • , chop () removes any character whatever, while
  • chomp () removes
only if it is a newline. As always we need to remove only a newline is safer to use
chomp ()
.
The first will be to user data. The way to do this is to print some text on the screen to request the name and then read what the user enters, keeping it in a variable. This information, which is viewed through standard input (STDIN

), you can easily apply chomp function. As this information is in a variable, it is also easy to reuse that variable to our print instruction. # / usr / bin / perl #----------------- # Script Name: Hello.pl # Script Version: 2.0 # Date: 26.08.2007
# Author: goblin
# Description: Prompts user for name, strips of newline character # and prints "Hello !" screen WHERE name = the whole text.
# Revision History:
# 1.0: original
# version 2.0: added prompt for user's name and returned text based on it.
#-----------------
# ask user for name
print "What is your name?"
$ input =
;
# remove newline character
chomp ($ input);
# print results to page
print "Hello $ input! \\ n";



see that you can use $ input
within quotes function print. If we had used single quotes would have sent "$ input" literally to the screen.

Now try your program and if you have any doubts leave it in the comments.



Related articles:

Perl Manual: Introduction

Perl Manual (II): Before code basic SQL Manual (I) : Introduction






0 comments:

Post a Comment