08-10-2012
Thank you for the answer.
But I need to convert the numbers inside the perl script using constants and not on command prompt.
How can I assign the converted values to the constant '$num' as per my example? please inform.
Thanks.
Mysore Ganapati.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Does anyone know how to convert this bash shell script to perl?
for i in `ls -l *pgp`
do
`usr/bin/gpg --passphrase-fd 0 $i < .sunspot`
done
Thanks! Any help would be appreciated. I'm new to Linux and perl. (4 Replies)
Discussion started by: freak
4 Replies
2. Shell Programming and Scripting
I have a perl code that runs like
Code I
sub p
{
if ($d >= $D) {return}
printf "%3s"x$d++," ";
printf "%s%s\n",$_,$h{$_}?" ** ":"";
if (!$h{$_})
{
$h{$_}=1;
map {p($_)} @{$s{$_}}
}
$d--
}
($Set,$Job,$Num,$D) = (@ARGV);
map {shift} 0..3; (8 Replies)
Discussion started by: zainravi
8 Replies
3. Shell Programming and Scripting
Hi,
I need convert a date string to date.
For eaxmple
$last_date=6/2/2009
and I want to change the format of the above mentioned date to "Jun 2 2009 12:00AM".
Do we have any functionality or staright method to convert to the desired format? (4 Replies)
Discussion started by: siba.s.nayak
4 Replies
4. Shell Programming and Scripting
Hello All,
I want to convert .pl to .exe with all include libraries like:
WIN32/OLE.....
Please suggest me how i will proceed for this.... (7 Replies)
Discussion started by: suvenduperl
7 Replies
5. UNIX for Advanced & Expert Users
Hello,
I have an AIX 5.3 system and i created a script to get the last login of users.
The script goes like this:
LAST_LOGIN=`lsuser -a time_last_login $cur_user`
TIME_LOGIN=`perl -e 'print scalar localtime("$LAST_LOGIN")'`
Actually what i do in these two lines is to set a variable... (2 Replies)
Discussion started by: omonoiatis9
2 Replies
6. Shell Programming and Scripting
Hello all!
This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician.
Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix:
... (16 Replies)
Discussion started by: torchij
16 Replies
7. Shell Programming and Scripting
Suppose
file1.bim
1 rs1 0 0 G A
1 rs3 0 1 A C
2 rs8 0 0 G A
2 rs2 0 0 T C
3 rs10 0 0 0 T
3 rs11 0 0 T 0
(N*6 table, where N is arbitary,in this case 6, where 2nd column is the name of SNP, and the 5th,6th are genotype data, where 0 means missing information)
There is... (9 Replies)
Discussion started by: johnkim0806
9 Replies
8. Shell Programming and Scripting
I am working on converting shell to Perl script. In shell we have built in function
trap
Do you know alternative in Perl or actually we don't need it?
Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies
9. UNIX for Beginners Questions & Answers
Hello. I'm trying to convert an awk script I wrote to perl (which I just started self-teaching). I tried the a2p command but I couldn't make sense of most of it.
Here was the awk code:
BEGIN{
FS = ","
print "NAME\tLOW\tHIGH\tAVERAGE"
a=0
}
{
if(a==0){
a+=1 (1 Reply)
Discussion started by: Eric7giants
1 Replies
10. UNIX for Beginners Questions & Answers
Hello. I'm currently teaching myself Perl and was trying to turn an awk code that I had written into Perl. I have gotten stuck on a particular part and a2p has not helped me at all. The task was to take a .csv file containing a name, assignment type, score and points possible and compute it into a... (1 Reply)
Discussion started by: Eric7giants
1 Replies
LEARN ABOUT OSX
constants
math::constants(n) Tcl Math Library math::constants(n)
__________________________________________________________________________________________________________________________________________________
NAME
math::constants - Mathematical and numerical constants
SYNOPSIS
package require Tcl ?8.3?
package require math::constants ?1.0.1?
::math::constants::constants args
::math::constants::print-constants args
_________________________________________________________________
DESCRIPTION
This package defines some common mathematical and numerical constants. By using the package you get consistent values for numbers like pi
and ln(10).
It defines two commands:
o One for importing the constants
o One for reporting which constants are defined and what values they actually have.
The motivation for this package is that quite often, with (mathematical) computations, you need a good approximation to, say, the ratio of
degrees to radians. You can, of course, define this like:
variable radtodeg [expr {180.0/(4.0*atan(1.0))}]
and use the variable radtodeg whenever you need the conversion.
This has two drawbacks:
o You need to remember the proper formula or value and that is error-prone.
o Especially with the use of mathematical functions like atan you assume that they have been accurately implemented. This is seldom or
never the case and for each platform you can get subtle differences.
Here is the way you can do it with the math::constants package:
package require math::constants
::math::constants::constants radtodeg degtorad
which creates two variables, radtodeg and (its reciprocal) degtorad in the calling namespace.
Constants that have been defined (their values are mostly taken from mathematical tables with more precision than usually can be handled)
include:
o basic constants like pi, e, gamma (Euler's constant)
o derived values like ln(10) and sqrt(2)
o purely numerical values such as 1/3 that are included for convenience and for the fact that certain seemingly trivial computations
like:
set value [expr {3.0*$onethird}]
give exactly the value you expect (if IEEE arithmetic is available).
PROCEDURES
The package defines the following public procedures:
::math::constants::constants args
Import the constants whose names are given as arguments
::math::constants::print-constants args
Print the constants whose names are given as arguments on the screen (name, value and description) or, if no arguments are given,
print all defined constants. This is mainly a convenience procedure.
BUGS, IDEAS, FEEDBACK
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math ::
constants of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you
may have for either package and/or documentation.
KEYWORDS
constants, degrees, e, math, pi, radians
CATEGORY
Mathematics
COPYRIGHT
Copyright (c) 2004 Arjen Markus <arjenmarkus@users.sourceforge.net>
math 1.0.1 math::constants(n)