I have the following program:
#!/usr/bin/perl
use warnings;
use strict;
my $_ = 'Hello$xWorld';
my $x = 'abc';
print /$x/;
The output is nothing :(
How can I ask Perl not to interpolate $x ?
Thanks in advance !
Hello experts !
When I run the program below I get the following:
print (...) interpreted as function at C:\perlscripts\hello.pl line 6.
1
Why is this warning appears and what is the meaning of it ?
Thanks !
#!/usr/bin/perl
use warnings;
use strict;
my $s = 'func(a,b)';
print ($s =~...
Hello !
I have 2 little questions:
1) How do I ask Perl if $x belongs to list @array ?
2) How do I ask Perl if $x is one of the keys of hash %h ?
Thanks !!
Hello experts !
What is the most efficient way to get a list of all file names (a full path) in a certain directory ?
This should work recursively and include only files (not directories).
Thanks in advance !
Hi !
Can anyone tell me please why the following program does not found the word CAT ?
If I put the pattern in single quotes, it works.
Why ??
#!/usr/bin/perl
use warnings;
use strict;
$_ = 'laKJJlala AHAJJ--- CAT =-=-123 sad(!@*# xsaa KUKU ff';
my $pattern = ".*(\bCAT\b).*";
my @arr;
my...
Can someone tell me please why in the following program $1 is not defined ? I thought that every group (every pair of parentheses) is going to $1, $2, $3 and so on.
Where am I wrong ?
Which pairs of parentheses are going to $1, $2, $3, ... ?
Thanks in advance !!
$_ = "a bc";
if (/(bc)?/) {...
Hello !
Can someone explain me please why
print 3==4;
prints nothing ?
I would expect 3==4, which is false, to be converted to 0, so I expect "print" to print "0". Where am I wrong ?
Thanks !
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.