Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Mysql and Perl Module

by endymion (Acolyte)
on Jun 14, 2012 at 09:21 UTC ( #976158=note: print w/ replies, xml ) Need Help??


in reply to Re: Mysql and Perl Module
in thread Mysql and Perl Module

Hello, I don't understand the meaning of %s ? Is this a hash ? I'm getting my information from an array. My problem is I don't know how many columns I'm getting.


Comment on Re^2: Mysql and Perl Module
Re^3: Mysql and Perl Module
by Anonymous Monk on Jun 14, 2012 at 09:33 UTC

    Hello, I don't understand the meaning of %s ? Is this a hash ?

    No, its a string, a format string

    If you use perl -MO=B::Deparse,-p myfile.pl to see how perl parses my code, you can see how that format string is the first argument to the sprintf function

    I'm getting my information from an array. My problem is I don't know how many columns I'm getting.

    You don't need to know, the array/code I posted knows that information, and does the right thing -- I linked a runnable example ( Re: Open multiple file handles? ) a few minutes ago in Re^3: Mysql and Perl Module

      Thank you Monk :-) I'm trying at the moment to adapt your example on my requirements. This is very helpful.
Re^3: Mysql and Perl Module
by tospo (Hermit) on Jun 14, 2012 at 09:35 UTC
    in sprintf, %s is a placeholder for a string, as in:
    $a = "world"; sprintf "hello %s", $a; # results in "hello world"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://976158]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2014-12-19 02:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (70 votes), past polls