Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: sprintf( @_ ) doesn't do what I want!

by Athanasius (Archbishop)
on Oct 30, 2019 at 03:58 UTC ( [id://11108104]=note: print w/replies, xml ) Need Help??


in reply to sprintf( @_ ) doesn't do what I want!

Hello harangzsolt33,

huck has explained the problem. This would appear to be one of the rare cases in which Perl fails to DWIM, but the fix, although annoyingly verbose, is straightforward:

my $S = sprintf $_[0], @_[1 .. $#_];

BTW, when I run your script under Windows 8.1, 64-bit, I get a series of errors like this:

This version of C:\WINDOWS\TEMP\TMP2X137.COM is not compatible with th +e version of Windows that you're running. Check your computer's syste +m information and then contact the software publisher. This version of C:\WINDOWS\TEMP\TMP2X137.COM is not compatible with th +e version of Windows that you're running. Check your computer's syste +m information and then contact the software publisher.
The second question is has anyone ever written a perl module that does what I am trying to do here?

For Linux, there is the Curses module which I think does everything you need. For Windows, you will need to search CPAN, for example the Win32:: namespace. (I have a vague memory that I found a module for Windows that promised exactly what you’re looking for, but I couldn’t get it to install. :-(. But I can’t find the details, sorry.)

Update: Have a look at Win32::Console.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-03-28 20:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found