Sponsored Content
Full Discussion: Perl help!! (pack()?)
Top Forums Shell Programming and Scripting Perl help!! (pack()?) Post 86869 by Euler04 on Tuesday 18th of October 2005 06:52:42 AM
Old 10-18-2005
Perl help!! (pack()?)

Hello everyone.

I wrote a perl script to get the two answers from a value: x.
By this, I want to do sqrt($x) in different precision.
Code:
#!/usr/bin/perl

print "Input the initial value x:\n";
chomp($x=<STDIN>);
$comp=sqrt($x);
$float_value=pack("f", $comp);
$double_value=pack("d", $comp);
print "The answer by flaot is $float_value.\n";
print "The answer by double is $double_value.\n";
exit;

I don't know how to use "pack" function.
Please tell me.

Last edited by Euler04; 10-18-2005 at 08:12 AM..
 

10 More Discussions You Might Find Interesting

1. Programming

How use #pragma pack() in HP unix ?

hello. i use follow sentences in include files in SCO unix is ok. #pragma pack(1) struct dddd { int iD1; char cCh1; ... }; #pragma pack() but in hp-9000 unix , not ok when compiling, cc not support #pragma pack(1) how to settle the question ? ... (1 Reply)
Discussion started by: bdyjm
1 Replies

2. Shell Programming and Scripting

Perl + pack() + spaceing question

ok guys and gals at the moment i am perplexed (prolly cuz i been looking at it to long) but here it is. OS: sol8 perlver: 5.8.0 shell: ksh answer must be in perl!! issue: when i use pack() it packs the data at the front of the requested field space. normally it wouldnt be a problem if... (1 Reply)
Discussion started by: Optimus_P
1 Replies

3. AIX

Aix - Service Pack

I've recently installed ServicePack1 for Tecnology_Level 9 of AIX 5.2 . The result of installation is "OK" but with oslevel -s i dont see the service pack installed .... after many research i try (with many luck!!) instfix -i|grep SP and the result : All filesets for 5200-08-01_SP... (1 Reply)
Discussion started by: BabylonRocker
1 Replies

4. UNIX for Dummies Questions & Answers

Pack current folder

How do I pack (using tar zcvf ?) the current folder inluding all files and folders ?? I need to be sure to get all files and folders/subfolders... Later I will unpack into a new folder on a new server.. Appreciate any help.. (3 Replies)
Discussion started by: WebWatch
3 Replies

5. UNIX for Dummies Questions & Answers

perl pack and unpack commands

I have a file that contains user id and corresponding password. Lets say password is "help". The below command will create a hex value for string "help". perl -e 'print unpack "H*","help"' So now password is in encoded format. Then I decoded it in the script where am fetching the... (1 Reply)
Discussion started by: max_payne1234
1 Replies

6. Shell Programming and Scripting

Bash equivalent of perl's pack function ?

Is there an equivalent of perl's pack function in bash ? Or in other words, how can I achieve the same thing in bash ? Much appreciated. (1 Reply)
Discussion started by: NewDeb
1 Replies

7. UNIX for Advanced & Expert Users

Perl-to-Oracle performance: DBI-pack visa 'sqlplus' usage

I wondering if anybody tried already or know about the performance to process some Oracle staff from Perl. I see it could be done by the DBI pachage (so, I guess, it is interface to the OCI, but who know how sufficiant it is..,) with all gemicks around (define, open, parce, bind,.. ), or it can... (8 Replies)
Discussion started by: alex_5161
8 Replies

8. UNIX for Dummies Questions & Answers

perl pack and unpack commands

I am using pack/unpack to encyrpt a file. syntax is below #!/bin/sh encrypt=`perl -e 'print unpack "H*","yourpassword"'` - echo $encrypt >/file/to/store/encrypted/password pass=`cat /file/to/store/encrypted/password` decrypt=`perl -e 'print pack "H*",$pass'` ... (2 Replies)
Discussion started by: erinlomo
2 Replies

9. Solaris

weblogic Maintenance pack

Hi ALL, I am running weblogic portal(9.2.2) on solaris and i wanted to apply maintenance pack and upgrade it to 9.2.3. Without using x-windows system how can i apply maintenance pack.? (0 Replies)
Discussion started by: gaurav183
0 Replies

10. Shell Programming and Scripting

Pack and unpack localtime in perl script

Hi I have a code like this: sub WriteEbcdicHeader { my $Htimestamp=localtime();#i need to pack and unpack this my $eheaderline = $Htimestamp; #packing has to be done here #unpacking has to be done after packing print $EOUTFILE return $eheaderline; } sub WriteEbcdicTrailer { ... (5 Replies)
Discussion started by: rbathena
5 Replies
GIT-INDEX-PACK(1)						    Git Manual							 GIT-INDEX-PACK(1)

NAME
git-index-pack - Build pack index file for an existing packed archive SYNOPSIS
git index-pack [-v] [-o <index-file>] <pack-file> git index-pack --stdin [--fix-thin] [--keep] [-v] [-o <index-file>] [<pack-file>] DESCRIPTION
Reads a packed archive (.pack) from the specified file, and builds a pack index file (.idx) for it. The packed archive together with the pack index can then be placed in the objects/pack/ directory of a git repository. OPTIONS
-v Be verbose about what is going on, including progress status. -o <index-file> Write the generated pack index into the specified file. Without this option the name of pack index file is constructed from the name of packed archive file by replacing .pack with .idx (and the program fails if the name of packed archive does not end with .pack). --stdin When this flag is provided, the pack is read from stdin instead and a copy is then written to <pack-file>. If <pack-file> is not specified, the pack is written to objects/pack/ directory of the current git repository with a default name determined from the pack content. If <pack-file> is not specified consider using --keep to prevent a race condition between this process and git repack. --fix-thin Fix a "thin" pack produced by git pack-objects --thin (see git-pack-objects(1) for details) by adding the excluded objects the deltified objects are based on to the pack. This option only makes sense in conjunction with --stdin. --keep Before moving the index into its final destination create an empty .keep file for the associated pack file. This option is usually necessary with --stdin to prevent a simultaneous git repack process from deleting the newly constructed pack and index before refs can be updated to use objects contained in the pack. --keep=<msg> Like --keep create a .keep file before moving the index into its final destination, but rather than creating an empty file place <msg> followed by an LF into the .keep file. The <msg> message can later be searched for within all .keep files to locate any which have outlived their usefulness. --index-version=<version>[,<offset>] This is intended to be used by the test suite only. It allows to force the version for the generated pack index, and to force 64-bit index entries on objects located above the given offset. --strict Die, if the pack contains broken objects or links. NOTE
Once the index has been created, the list of object names is sorted and the SHA1 hash of that list is printed to stdout. If --stdin was also used then this is prefixed by either "pack ", or "keep " if a new .keep file was successfully created. This is useful to remove a .keep file used as a lock to prevent the race with git repack mentioned above. GIT
Part of the git(1) suite Git 1.7.10.4 11/24/2012 GIT-INDEX-PACK(1)
All times are GMT -4. The time now is 09:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy