In my frame constructor I have a function that easily makes a menu bar for me.
package Routines;
#This function will set up a menu
#REQUIRED: entries
#RETURNS: id, menu
sub SetupMenu {
$menuItemCount = 0; #Element number under the same menu
$subMenuCount = 0; #Number of menus
$mbar ...
perl -E '$i=@{[`zypper lr`]}-2;map{`zypper rr $_`}1..$i'
What would be a good way to write this perl-onliner in bash. ( I would like to remove all repositores with zypper)?
...
Currently we use DBIx::Class::Schema::Loader to generate and regenerate (when our db schema changes) a set of Result classes.
We add additional relationships and methods to the bottom of these classes and this is causing merge hell when people regenerate or change the schema.
We would like to maintain our custom changes in a separate...
I'm having issues with Unicode characters in Perl. When I receive data in from the web, I often get characters like “ or €. The first one is a quotation mark and the second is the Euro symbol.
Now I can easily substitute in the correct values in Perl and print to the screen the corrected words, but when I try to output to ...
I am modifying some HTML pages and want to increase the font size dynamically with a regex. In my script below, I want the '8' and '3' to turn into '9' and '4' but I get '8++' and '3++', respectively. I have the following:
#!/usr/bin/perl
use warnings;
use LWP::Simple;
my $content = "<TD><FONT STYLE=\"font-family:Verdana, Geneva, sans-...
In perl you can write
$string =~ tr/[a,e,i,o,u,y]/[A,E,I,O,U,Y]/;
for example.
Is it possible to achieve the same "translation" effects with VB.Net regexes?
Thanks you!
PS: I'm not searching for a way to port this very example, it's more of a curiosity question :)
...
I want to hide the mainwindow for a certain amount of time then show it again.
Example:
use Tk;
my $mw = new MainWindow;
my $lblMsg = $mw -> Label(-text=>"blabla")-> grid();
my $btnPostpone = $mw -> Button(-text=>"Postpone for (min): ",
-command =>\&postpone)-> grid();
MainLoop;
sub postpone{
$mw-> withdraw();
sleep(1);...
i write this perl code :
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
my $ua = LWP::UserAgent->new();
my $req = POST 'http://example.com',
[ hfc /[pos]/ => 'yayaya' ];
$content = $ua->request($req)->as_string;
but when i compile it i get this error :
syntax error at C:\Documents and Settings\ysys\ya.pl line 5, near "/ =...
I want to output strings into 8 columns, but I want to keep the spacing the same. I dont want to do it in HTML, but I am not sure how to do it normally. Example:
Something Something Something Something Something
Else Else Else Else Else
Another Another Another Another ...
How Can i convert a perl script into a C code?
...
From this article,
/^1?$|^(11+?)\1+$/ checks whether a number(its value in unary) is prime or not.
Using this, perl -l -e '(1 x $_) !~ /^1?$|^(11+?)\1+$/ && print while ++$_;' returns a list of prime numbers.
I do not have enough experience with Perl, but what I understand is that the regular expression will be true for a number that ...
I have the following data in a CSV file.
2454,"dum my"
12345,"dummy"
300001,"du m m y"
I was wondering, what regular expression I can use, to turn them into
002454,"dummy"
012345,"dummy"
300001,"dummy"
Thanks.
...
Given a simple case of two tables - Term and Definition - where Term has_many Definitions and Definition belongs_to Term, all terms and the corresponding definitions are to be fetched and displayed somehow.
Here is what I've come up with so far:
my $terms= $schema->resultset('Term')->search(undef, {
prefetch => 'definitions',
}...
Is there a way to replace text with a regex inline, rather than taking the text from a variable and storing it in a variable?
I'm a perl beginner. I often find myself writing
my $foo = $bar;
$foo =~ s/regex/replacement/;
doStuff($foo)
where I'd really like to write
doStuff($bar->replace(s/regex/replacement/));
or the like, rather...
While working on a simple programming exercise, I produced a while loop (DO loop in Fortran) that was meant to exit when a real variable had reached a precise value.
I noticed that due to the precision being used, the equality was never met and the loop became infinite. This is, of course, not unheard of and one is advised that, rather ...
Hi.
Is it possible to have 2 file handles for the same file?
open TXT,"+>","New" or die "Cannot Create File \n";
print TXT "Line1 \n";
open TXT1, ">>New" or die "Cannot open file";
print TXT1 "Line2 \n";
will this work?
...
any way would be fine. Perl, python, ruby...
...
Hi,
I am using Expect in Perl to accomplish one task. After sending the command I am expecting either Success or ERROR as the output, depending on which I need to print to a file saying that it was successful or failed.
$exp->expect(30,
'-re', "Success", printf LOG "Successfully Deleted \n" => sub {exp_last;},
'-re', "ERROR", ...
my @DATA_PES = (
{ col_name=>"rpad(request_no,9) as request_number",col_width=>9,col_mandatory_yn=>"n" }
what does this mean
...
Given
# package main;
our $f;
sub f{}
sub g {}
1;
How can I determine that $f, but not $g, has been declared? Off the cuff, I'd thought that *{main::g}{SCALAR} might be undefined, but it is a bona fide SCALAR ref.
Background: I'd like to import a variable into main::, but carp or croak if that variable is already declared.
EDIT Ad...