Sponsored Content
Full Discussion: sprintf result on perl
Top Forums Shell Programming and Scripting sprintf result on perl Post 302295970 by pludi on Tuesday 10th of March 2009 05:01:05 AM
Old 03-10-2009
Usually, you assign the result of sprintf to a scalar ($) instead of an array (@). With an array as left side operator, you get the result of sprintf in the first and only element of the array.

What's the code in question that works incorrectly?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

different result on shell and on perl HELP NEEDED

hi i am using this command which would return to be the filename ls -l $dir1 | awk '{print $9}' however on perl when i use: `ls -l $dir1 | awk '{print \$9}' > tmp` it gives me a different result. Everything is the same however a directory does not contain the the forward slash so i... (2 Replies)
Discussion started by: nookie
2 Replies

2. Programming

equivalent of sprintf in C++

Hi My requirement is to convert the following to C++ char buffer; sprintf(buffer,"%s %-50s %6s %-6d %s\n",a.substr(0,5),a.substr(10,20)) Since the buffer is of varying length, i cannot hardcode the value as 90. i would like to convert the buffer to string object so that it can receive any... (1 Reply)
Discussion started by: dhanamurthy
1 Replies

3. Shell Programming and Scripting

Perl script to search sprintf and replace with snprintf

Dear all, I am new to perl script and would need some help for my 1st script. I wrote a script to search sprintf(buf,"%s", sourcestring) and replace with snprintf(buf, sizeof(buf),"%s", sourcestring). As snprintf() requires an extra argument, so it is not a simple search-and-replace. I need to... (1 Reply)
Discussion started by: ChaMeN
1 Replies

4. Shell Programming and Scripting

printf vs sprintf - perl

I would like to assign the output of printf to a variable in perl , it give me back a "1" instead of the time. How can I stuff the variable with what printf returns? Here is my code: #!/usr/bin/perl $time = localtime(time);... (3 Replies)
Discussion started by: Dabheeruz
3 Replies

5. Shell Programming and Scripting

Using Perl to query a website and parse the result

Hi, I am a JAVA programmer and I have no idea about perl. I did use it a long time ago and I don't even remember the basics. So here is my problem: In my work, I am supposed to build a simple program that opens a website (Gene Ontology)and passes my query and returns the result into a file. The... (1 Reply)
Discussion started by: chavanak
1 Replies

6. Shell Programming and Scripting

How do i access sybase using isql and how do i get result set in perl script?

Hi, How do i get result set in perl script using isql while connecting sybase server. I have a perl script which connected to sybase and get the result set. but i wanted to get the result set. How do i get the result set in perl script not unix shell script.. $server ="ServerName"; open... (1 Reply)
Discussion started by: solo123
1 Replies

7. Programming

Problem with Sprintf

Hi, I have the below sample code to hash the input number read from file. File will have 16 to 19 digit number and executable hash the number using some logic and returns the hashed value. Each digit in the 16 digit number is converted to a 4 byte value. That if the input is 16digit integer, the... (6 Replies)
Discussion started by: ramkrix
6 Replies

8. Shell Programming and Scripting

[Solved] Not able to quote perl function in sprintf() !

The required form of command is as perl /product/editique/RFR/preproc/scripts/ExprEval.pl -P 'EGAL_CHAINE (" ","")' -K /varsoft/editique/RFR/preproc/logs/D.RFR.PR.PCAC9.PCPA.00.54.20110920.Evaluate_Expression.logWhat's wrong with this code (it is not quoting the function, I have checked... (1 Reply)
Discussion started by: ezee
1 Replies

9. Shell Programming and Scripting

parsing XML result by using perl?

for some reasons, i need to parse the XML result by using perl. for instance, this is a sample XML result: <Response> <status>success</status> <answer>AAA::AAA</answer> <answer>BBB::BBB</answer> </Response> then i can use this way : my @output = (); foreach my $parts (@all) ##@all... (2 Replies)
Discussion started by: tiger2000
2 Replies

10. Shell Programming and Scripting

Perl : code on ping showing difference result

Hi all, I am using the below code to ping a code and print whehter the connection is successful or not. use Net::Ping; $p = Net::Ping->new(); my $host = "x.x.x.x"; # print "$host is alive.\n" if $p->ping($host); if ($p->ping($host,3)) { print... (0 Replies)
Discussion started by: scriptscript
0 Replies
HTML::Microformats::Datatype::String(3pm)		User Contributed Perl Documentation		 HTML::Microformats::Datatype::String(3pm)

NAME
HTML::Microformats::Datatype::String - text in a particular language SYNOPSIS
my $string = HTML::Microformats::Datatype::String ->new('Bonjour', 'fr'); print "$string "; DESCRIPTION
Constructor "$str = HTML::Microformats::Datatype::String->new($text, [$lang])" Creates a new HTML::Microformats::Datatype::String object. Public Methods "$str->lang" Return the language code. "$str->to_string" Return a plain (scalar) string. Functions "$str = ms($text, [$element])" Construct a new HTML::Microformats::Datatype::String object from a scalar, plus XML::LibXML::Element. If $element is undef, then returns the plain (scalar) string itself. This function is exported by default. (Note: the name 'ms' originally stood for 'Magic String'.) "isms($str)" Returns true iff $str is blessed as a HTML::Microformats::Datatype::String object. This function is exported by default. "$c = concat($a, $b, [$reverse])" Concatenates two strings. If the language of string $b is null or the same as $a, then the resultant string has the same language as $a. Otherwise the result has no language. If $reverse is true, then the strings are concatenated with $b preceding $a. This function is not exported by default. Can also be used as a method: $c = $a->concat($b); "compare($a, $b)" Compares two strings alphabetically. Language is ignored. Return values are as per 'cmp' (see perlfunc). This function is not exported by default. Can also be used as a method: $a->compare($b); BUGS
Please report any bugs to <http://rt.cpan.org/>. SEE ALSO
HTML::Microformats, HTML::Microformats::Datatype. AUTHOR
Toby Inkster <tobyink@cpan.org>. COPYRIGHT
Copyright 2008-2011 Toby Inkster This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. perl v5.14.2 2011-12-06 HTML::Microformats::Datatype::String(3pm)
All times are GMT -4. The time now is 09:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy