Archive for the 'perl' Category

array_multisort in php

December 9, 2008

Today i have used array_multisort function of php , its very easy …
I got a array, may be assoaciative example $name_array = (
[0] = array
(
[id] => 1,
[name] = > pravin
)
[1] = array
(
[id] => 2,
[name] = > navin
)
// and so on
)
// for sorting is by name alphabetically , we will use array_multisort();
first we will [...]

Perl array , hashes example

November 25, 2008

#!/usr/bin/perl
#here is something interesting to calculate occurence of same word in an array
#lets start
# lets make a simple array , in perl for array @ is used
my @words = (“I”,”love”,”perl”,”programming”,”I”);
#to get the length of the array, simply equate it to a variable
$no_of_words = @words; #this will give u 5 (length)
#now make some hashes (hashes are [...]

Now some amazing stuffs with file reading

June 30, 2008

For reading the whole file just needed one line code . hueeeeeee
> perl -ne ‘print’ filename
-n option is something that will read the file untill it gets null
filename is the name of the file which u wants to read

perl very easy language

June 30, 2008

How?
Lets take very simple example
$a =A;
$a++;
print $a;
what will be the output ? Don’t think too much its “B” surprised ! hahahahaha
Lets take another example
$x= po1;
$x++ ;
yea , now many will jumble whether the alphabet will get repeated or number?
Now its number now the output will be “po2″

perl quote

June 5, 2008

“There is more than one way to do things”

perl important links

June 5, 2008

1) http://www.perl.com/pub/a/2008/04/23/a-beginners-introduction-to-perl-510.html
2) http://perldoc.perl.org/index-functions.html

how to take input from keyboard and print to screen

May 8, 2008

#!/usr/bin/perl
$input = <STDIN>; // this will take input from keyboard
print $input ; // this will output to the screen

where is perl installed

May 8, 2008

by default its installed in linux
/usr/bin/perl
in scripts you have to write #!/usr/bin/perl to tell the script that it is perl interpreter.
sometimes the path is
/usr/local/bin/perl