10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have written a menu driven shell script in which as per the choice, I run the another script on background.
For eg:
1. get info
2)process info
3)modify info
All the operations have different scripts which i schedule in background using &.
However I wish to display the error... (0 Replies)
Discussion started by: ashima jain
0 Replies
2. Shell Programming and Scripting
Hi,
I want to put the following code as a parallel or background process
The program is as below:
$n=10; #Count of files to be created.
for($j=0;$j<=$n;$j++) {
open(FH,">files_$j.txt") || warn "cannot create a file\n";
{
print FH "count of file: $j\n"; #Sample data to be written. just... (5 Replies)
Discussion started by: vanitham
5 Replies
3. Shell Programming and Scripting
Hi,
I am using net::ftp for transferring files now i am trying in the same Linux server as a result ftp is very fast but if the server is other location (remote) then the file transferred will be time consuming.
So i want try putting FTP part as a background process. I am unaware how to do... (5 Replies)
Discussion started by: vanitham
5 Replies
4. UNIX for Dummies Questions & Answers
What I need to learn is how to use a script that launches background processes, and then kills those processes as needed.
The script successfully launches the script. But how do I check to see if the job exists before I kill it?
I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies
5. UNIX for Dummies Questions & Answers
I need to submit a script that will continue to run after logging out and after a reboot or shutdown.
I entered the following: nohup script &
The script continues to run in the background after logging off the system but is killed after a reboot or shutdown. Any help would be greatly... (1 Reply)
Discussion started by: powwm
1 Replies
6. Shell Programming and Scripting
Hi,
I have a query about processing and running Perl program at the background.
I have HTML file called Userform.html which accepts input from the user. As soon as input is given the contol goes to get.cgi (get.cgi does some processing and computing tasks).
Actually get .cgi takes more... (0 Replies)
Discussion started by: vanitham
0 Replies
7. Shell Programming and Scripting
i gave a copy process in the background( to copy around 100GB) , while in progress, the session got terminated. when i relogged in and checked the destination folder the copying was in progress... how could it happen(copying) when the shell terminates??? :rolleyes: (2 Replies)
Discussion started by: vinod.thayil
2 Replies
8. Shell Programming and Scripting
can anybody plz tell me
how can i find the background processes running. (2 Replies)
Discussion started by: Raom
2 Replies
9. UNIX for Dummies Questions & Answers
How, can I hide background process's output? (5 Replies)
Discussion started by: zylwyz
5 Replies
10. Shell Programming and Scripting
Hello all,
How do I start a background process and save the process id to a file on my system. For example %wait 5 & will execute and print the process id. I can't figure out how to get it to a file. I've tried: > filename 0>filename 1>filename.
Any assistance is most appreciated.
Thanks,
Jim... (10 Replies)
Discussion started by: jleavitt
10 Replies
Math::BaseCalc(3pm) User Contributed Perl Documentation Math::BaseCalc(3pm)
NAME
Math::BaseCalc - Convert numbers between various bases
VERSION
version 1.016
SYNOPSIS
use Math::BaseCalc;
my $calc = new Math::BaseCalc(digits => [0,1]); #Binary
my $bin_string = $calc->to_base(465); # Convert 465 to binary
$calc->digits('oct'); # Octal
my $number = $calc->from_base('1574'); # Convert octal 1574 to decimal
DESCRIPTION
This module facilitates the conversion of numbers between various number bases. You may define your own digit sets, or use any of several
predefined digit sets.
The to_base() and from_base() methods convert between Perl numbers and strings which represent these numbers in other bases. For instance,
if you're using the binary digit set [0,1], $calc->to_base(5) will return the string "101". $calc->from_base("101") will return the number
5.
To convert between, say, base 7 and base 36, use the 2-step process of first converting to a Perl number, then to the desired base for the
result:
$calc7 = new Math::BaseCalc(digits=>[0..6]);
$calc36 = new Math::BaseCalc(digits=>[0..9,'a'..'z']);
$in_base_36 = $calc36->to_base( $calc7->from_base('3506') );
If you just need to handle regular octal & hexdecimal strings, you probably don't need this module. See the sprintf(), oct(), and hex()
Perl functions.
METHODS
o new Math::BaseCalc
o new Math::BaseCalc(digits=>...)
Create a new base calculator. You may specify the digit set to use, by either giving the digits in a list reference (in increasing
order, with the 'zero' character first in the list) or by specifying the name of one of the predefined digit sets (see the digit()
method below).
If your digit set includes the character "-", then a dash at the beginning of a number will no longer signify a negative number.
o $calc->to_base(NUMBER)
Converts a number to a string representing that number in the associated base.
If "NUMBER" is a "Math::BigInt" object, "to_base()" will still work fine and give you an exact result string.
o $calc->from_base(STRING)
Converts a string representing a number in the associated base to a Perl integer. The behavior when fed strings with characters not in
$calc's digit set is currently undefined.
If "STRING" converts to a number too large for perl's integer representation, beware that the result may be auto-converted to a
floating-point representation and thus only be an approximation.
o $calc->digits
o $calc->digits(...)
Get/set the current digit set of the calculator. With no arguments, simply returns a list of the characters that make up the current
digit set. To change the current digit set, pass a list reference containing the new digits, or the name of a predefined digit set.
Currently the predefined digit sets are:
bin => [0,1],
hex => [0..9,'a'..'f'],
HEX => [0..9,'A'..'F'],
oct => [0..7],
64 => ['A'..'Z','a'..'z',0..9,'+','/'],
62 => [0..9,'a'..'z','A'..'Z'],
Examples:
$calc->digits('bin');
$calc->digits([0..7]);
$calc->digits([qw(w a l d o)]);
If any of your "digits" has more than one character, the behavior is currently undefined.
QUESTIONS
The '64' digit set is meant to be useful for Base64 encoding. I took it from the MIME::Base64.pm module. Does it look right? It's sure
in a strange order.
AUTHOR
Ken Williams, ken@forum.swarthmore.edu
COPYRIGHT
This is free software in the colloquial nice-guy sense of the word. Copyright (c) 1999, Ken Williams. You may redistribute and/or modify
it under the same terms as Perl itself.
SEE ALSO
perl(1).
perl v5.12.3 2011-05-16 Math::BaseCalc(3pm)