you have a question on how to do something in Perl, or
you need a Perl solution to an actual real-life problem, or
you're unsure why something you've tried just isn't working...
then this section is the place to ask. Post a new question!
However, you might consider asking in the chatterbox first (if you're a
registered user). The response time tends to be quicker, and if it turns
out that the problem/solutions are too much for the cb to handle, the
kind monks will be sure to direct you here.
I'm new here and need to implement a certain automation for linux process. But I'm stuck at a point where first I need to check a command suggestions before executing the actual command depending on certain condition. By command suggestion, I mean the suggestion or next steps displayed for a command when we press <TAB><TAB>.
I have tried doing the following things but not even a single one worked:
$connection = Net::SSH::Expect(); #connection to a server
$connection->get_expect()->send("011"); # octal for tab
So basically once sending <TAB><TAB> characters, I can read suggestions using $connection->read_all() but not able to figure out how to get suggestions using tab. It would be great if any of you amazing monks can guide me through this mountain!
The above code is wrong, is bad, works sometimes. I know this is wrong. Trying to figure out the right way. I wrote the little test script below.
In the below script the multi-compare Option Equals works fine. But the multi-compare Option Not Equal does not work. Why? How to fix?
For example, set $a = 77 and the Option Not Equal does not work.
Thanks for the help!
$a = 8; #Try using 7 and see how second loop does not evaluate correct
# $a = 44 evaluates ok for both options
# $a = 33 evaluates ok for both options
# $a = 3 does not evalute correctly on Option Not Equal
# $a = 77 does not evalute correctly on Option Not Equal
# $a = 8 does not evalute correctly on Option Not Equal
## Option Equal
if (($a == 3) || ($a == 77) || ($a == 8))
print "$a must be a 3 77 or 8\n";
print "$a is not a 3 77 or 8\n";
## Option Not Equal
if (($a != 3) || ($a != 77) || ($a != 8))
print "$a is not a 3 77 or 8\n";
print "$a is a 3 77 or 8\n";
I have been documenting my Random modules in a readme for GitHub when I came across some that have external data. Two of them have text files that I open, chomp, and make into an array; nothing special. However, the data for those two are in my general data directory. If I people want to use these modules (and if I ever get them properly written), I will need to put the data closer to them. Now, I just don't know where to put them. (The other modules with external data need hashes made, and that is a bigger problem.)
You might be wondering why I did not put the data directly into the module. It is because two of the lists are over 100 items long and the other two are over 10 with longer strings.
I am also looking to move these Random modules away from using any of my Util modules. My Util modules are messes and for my personal use. (So many PODs to update with their dependencies, hopefully without using any of those Util modules one day.)
I know it may be a matter of taste, but where you would put data files relative to the module that uses them?
My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.8.8 on web host.
No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
Hi, in a large-size perl/Tk program we are adding tags. Sometimes there are tens of thousands of tags to add, and this can take a lot of user real-time. Our window has a status bar, so I'd like to have something in it like,
Adding 1500 of 37885 tags. Press 's' to stop adding tags...
and have that update every 500 tags.
My question is, how can I detect the user entered 's' at this point in the code? I thought of adding a key binding, which I guess is the only way to do so, but would this intercept the user, say, typing a filename containing a 's' in a dialog box? In that case, is there a way to enable the key binding at just the point I need it, then disable it at the end? Or do I have to use something more unlikely, like CTRL+S?
Or is there a better way? Online searches have not been fruitful. Thank you!
In following the kerfuffle on p5p about the planned release of perl 7, I've noticed a repeated claim that use of barewords as filehandles will be disallowed in perl 7.
What's so wrong with doing open RD, '<', 'file.txt' ?
Is there some official perl documentation about any such issue ?
i am trying to fetch a value from a string after _ using regex and try to store that value in a variable that i can use somewhere else, like below....also we can have any number in place of 5 like 8, 9 , 10 or 20
my $job = "50.10-d557_5";
my $Path = "";
$path = /home/data/5/file1.log
Hello, I am experimenting with templating a table. I have no issues with fixed data structures... but now I need to generate a table with HTML::Template where the number and the names of the columns may vary. I generate my data like this:
So basically, I want to simulate how bash extracts the value but with perl.
I could probably create some regexes for this but I'm quite sure some obscure scenario will be left out not to mention the possibility of badly malformed user input. So is there any module out there that might make extracting this value more of a no-brainer?