WaZaRWiki : PerlTips

GaelReignier :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register :: Hosted by: eNiX

Revision [383]

Most recent edit made on 2010-04-20 14:17:16 by GaelReignier

Additions:

The way each behaves ...

http://www.cs.mcgill.ca/~abatko/computers/programming/perl/howto/hash/:




Revision [382]

Edited on 2010-04-19 20:22:01 by GaelReignier

Additions:

Proper way to do a for loop

Do not ask me why though ...
for (; $i < $arraySize ; $i ) {




Revision [339]

Edited on 2009-10-04 22:12:35 by GaelReignier

Additions:
Here is the post I found online that helped me to solve this problem: http://www.nntp.perl.org/group/perl.beginners/2007/11/msg96639.html




Revision [338]

Edited on 2009-10-04 14:18:29 by GaelReignier

Additions:

print color("yellow"), "Danger, Will Robinson!\n", color("reset");
print color("green"), "Danger, Will Robinson!\n", color("reset");
print color("blue"), "Danger, Will Robinson!\n", color("reset");




Revision [337]

Edited on 2009-10-04 14:15:20 by GaelReignier

Additions:

use Term::ANSIColor;
print color("red"), "Danger, Will Robinson!\n", color("reset");


Deletions:
use Term::ANSIColor;
print color("red"), "Danger, Will Robinson!\n", color("reset");




Revision [336]

Edited on 2009-10-04 14:14:56 by GaelReignier

Additions:

Put some color in your life

Well, even if not in your life, at least in your script.
Reference website: http://docstore.mik.ua/orelly/perl/cookbook/ch15_06.htm
use Term::ANSIColor;
print color("red"), "Danger, Will Robinson!\n", color("reset");




Revision [335]

Edited on 2009-10-03 23:46:01 by GaelReignier

No differences.


Revision [334]

Edited on 2009-10-03 23:45:18 by GaelReignier

Additions:

Pass array to sub-routines

Normally it is not possible to pass array to sub routines.
The only way to do so is to pass a reference to the array when calling the sub-routine and then to use it in the sub-routine
WriteChangesTofile($new_configuration_file,\@changed_file);
sub WriteChangesTofile{
# Does not return anything. It OVERwrites the file
my $new_configuration_file=$_[0];
my @changed_file = @{$_[1]}; # This is the way to handle array passed to sub-routines. The array is passed as a reference
print "Updating: ".$new_configuration_file."\n";
open(NEW_CONF_FILE,">$new_configuration_file");
print (NEW_CONF_FILE @changed_file);
close(NEW_CONF_FILE);
}




Revision [258]

Edited on 2008-12-18 14:33:16 by GaelReignier

Additions:
$size = (-s 'ddserver.log');
print $size;


Deletions:
$size = (-s 'ddserver.log');
print $size;




Revision [257]

Edited on 2008-12-18 14:32:59 by GaelReignier

Additions:
 




Revision [104]

Edited on 2008-05-29 19:17:58 by GaelReignier

Additions:

String comparison

if ($ticketList ne )
ne: non equal
eq: equal




Revision [84]

Edited on 2008-05-22 12:19:31 by GaelReignier

Additions:
How to get the file size: http://www.perlmeme.org/faqs/file_io/filesize.html
$size = (-s 'ddserver.log');
print $size;




Revision [82]

Edited on 2008-05-21 13:52:00 by GaelReignier

Additions:
How to run a bash command in a Perl program: http://perl.about.com/od/programmingperl/qt/perlexecsystem.htm


Deletions:
How to run a bash command in a Perl program:




Revision [81]

Edited on 2008-05-21 13:45:59 by GaelReignier

Additions:
system("myCommand"); i.e.: system("/bin/ls");


Deletions:
exec("myCommand"); i.e.: exec("/bin/ls");




Revision [69]

Edited on 2008-05-12 18:55:17 by GaelReignier

Additions:
ITTips





Revision [57]

Edited on 2008-05-11 22:14:43 by GaelReignier

Additions:
CPAN install module: to install a module
How to run a bash command in a Perl program:
exec("myCommand"); i.e.: exec("/bin/ls");


Deletions:
CPAN install module to install




Revision [52]

Edited on 2008-05-11 16:29:35 by GaelReignier

Additions:
CPAN install module to install




Revision [51]

The oldest known version of this page was edited on 2008-05-11 16:28:06 by GaelReignier
How to use CPAN?
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.1994 seconds