DevTech101

DevTech101

perl

Modifying perl config by hand – just modify Config.pm

The post below will show you how to generate the Config.pm Then if you still need configuration changes (for example proxy) just modify the file by hand. To initially configure perl cpan. Make note of the config file & directory, for example below its /user/.cpan/CPAN/MyConfig.pm perl -MCPAN -e shell [..] snip Would you like to …

Modifying perl config by hand – just modify Config.pm Read More »

perl how to change from string to a number

Below you can asee a subrutine that will cause perl to undrtsnad this as numbers foreach (@full_cpu_data) {         $_ =~ s/K//;         @cpu_data = split(':', $_);         @cpu_data  = map { $_ += 0 } @cpu_data;            push @cpu_plot, { cpu => @cpu_data[3], core => @uptime[6], disk => @disk[4] };         $i++; }  

Show installed perl modules

To list all installed perl modules #!/usr/bin/perl # ## # #!/usr/bin/perl use ExtUtils::Installed; my $instmod = ExtUtils::Installed->new(); foreach my $module ($instmod->modules()) { my $version = $instmod->version($module) || “???”; print “$module — $version\n”; }