defined\n";
}
Unfortunately, that doesn't receive anything. I have verified with netcat
that the connection between the two hosts is possible. The listener
doesn't receive anything from netcat, either.
How can that be? My program for the relais works the same, and it does
re
ear printing to a closed file handle *doesn't* (doesn't
always?) throw a SIGPIPE. I set the signal handler
$ perl -wE 'use strict; $SIG{"PIPE"} = sub { die "pipe\n" }; open(OUT, ">",
"/tmp/out"); close OUT ;my $res = print OUT "hi mom\n
On Thursday, September 30, 2021 9:30:01 PM CEST Andy Bach wrote:
> > https://perldoc.perl.org/functions/print says that 'print' would return
>
> true
>
> > if successful and doesn't say what it returns otherwise. It also says
>
> that
>
> > &
> https://perldoc.perl.org/functions/print says that 'print' would return
true
> if successful and doesn't say what it returns otherwise. It also says
that
> "Printing to a closed pipe or socket will generate a SIGPIPE signal."
Looks like print returns 1 if it
uccessful or not? It's like I'm seeing the
error message and there isn't anything I could do about it.
https://perldoc.perl.org/functions/print says that 'print' would return true
if successful and doesn't say what it returns otherwise. It also says that
"Printi
Hello.
I want to represent up to a few hundreds gigabytes for file size.
On 32bits platform, I noticed that
my $value = ...;
printf("%u\n", $value);
prints 4294967295 if $value >= 4294967295 whereas
my $value = ...;
printf("%s\n", $value);
and
use Math::BigInt;
my $value = ...;
Hello.
I want to represent up to a few hundreds gigabytes for file size.
On 32bits platform, I noticed that
my $value = ...;
printf("%u\n", $value);
prints 4294967295 if $value >= 4294967295 whereas
my $value = ...;
printf("%s\n", $value);
and
use Math::BigInt;
my $value = ...;
On 2018/11/15 9:27, sisyphus wrote:
> Are you actually encountering files larger than 1e15 bytes ?
On 32bit kernels, filesystems would not allow such large files.
For example, max size for xfs filesystem is 16TB.
Even on 64bit userspace, nobody will want to upload such large file
via network.
>
I received a comment from Peter John Acklam (current bigint maintainer).
Forwarded Message
Date: Wed, 14 Nov 2018 20:08:27 +0100
Hello
This has actually nothing to do with Math::BigInt. The issue here is that
the conversion "u", converts a number to an unsigned integer before t
On Thu, Nov 15, 2018 at 1:49 AM Tetsuo Handa <
penguin-ker...@i-love.sakura.ne.jp> wrote:
> 32bits userspace on 64bits kernel:
> # truncate -s 9223372036854775807 test
> # perl -e 'use File::stat; my $sb = lstat("test"); printf("%s\n",
$sb->size);'
> 9.22337203685478e+18
> # perl -e 'use File::sta
On 2018/11/14 21:46, sisyphus wrote:
> On Wed, Nov 14, 2018 at 10:20 PM Tetsuo Handa
> wrote:
>
>> Even on 32bit environments (at least for Linux), lstat() calls 64bit version
>
Here is some test results on Linux.
32bits userspace on 32bits kernel:
# truncate -s 17592186044415 test
# perl -e
On Wed, Nov 14, 2018 at 10:20 PM Tetsuo Handa <
penguin-ker...@i-love.sakura.ne.jp> wrote:
> Even on 32bit environments (at least for Linux), lstat() calls 64bit
version
When I check on Windows, I find that the value is actually an NV (not an IV
as I had expected).
I expect it's the same for you,
On 2018/11/14 19:59, sisyphus wrote:
> On Wed, Nov 14, 2018 at 9:08 PM Tetsuo Handa
> wrote
>
>> how can I pass $sb->size to Math::BigInt->new() as a string (assuming that
>> $sb->size is an integer) ?
>
> To answer the question, you can do:
>
> my $x = $sb->size;
> $value = Math::BigInt->ne
On Wed, Nov 14, 2018 at 9:08 PM Tetsuo Handa <
penguin-ker...@i-love.sakura.ne.jp> wrote
> how can I pass $sb->size to Math::BigInt->new() as a string (assuming
that $sb->size is an integer) ?
To answer the question, you can do:
my $x = $sb->size;
$value = Math::BigInt->new("$x");
But doing so
Hello, sisyphus.
Thank you for your answer.
> That can fail if $value is so big that it requires more than 15 decimal
> digits to express it accurately.
I want to use like
(...snipped...)
my $sb = lstat($file) || next;
next unless (S_ISREG($sb->mode) && $sb->size);
(...snipped...)
$cu
e >= 4294967295 whereas
>
>my $value = ...;
>printf("%s\n", $value);
>
That can fail if $value is so big that it requires more than 15 decimal
digits to express it accurately.
For example:
C:\_32>perl -le "printf '%s', 901234567890123456789;"
9.0123
I don't have an answer for you, but I find this
interesting. I note the same issue in 64bit
up near
18446744073709551615
I'm guessing the guy who wrote
Math::BigInt
may have the answer.
Mike
On 11/13/2018 8:07 AM, Tetsuo Handa wrote:
Hello.
I want to represent up to a few hundreds gigaby
Hello.
I want to represent up to a few hundreds gigabytes for file size.
On 32bits platform, I noticed that
my $value = ...;
printf("%u\n", $value);
prints 4294967295 if $value >= 4294967295 whereas
my $value = ...;
printf("%s\n", $value);
and
use Math::BigInt;
my $value = ...;
On Thu, Jul 9, 2015 at 6:01 AM, Nagy Tamas (TVI-GmbH) <
tamas.n...@tvi-gmbh.de> wrote:
> Hi,
>
>
>
> The following code doesn’t recognize dirs. As I list the dir into the XML,
> it shows dirs as ordinary files.
>
>
>
> Like the –d would not work. If I add an extra branch to recognize files
> with
Hi,
The following code doesn't recognize dirs. As I list the dir into the XML, it
shows dirs as ordinary files.
Like the -d would not work. If I add an extra branch to recognize files with
-f, it doesn't print either files at all nor dirs.
sub Traverse
{
opendir(DIR, $dir) or d
mber across the botom of it.
The data is being generated by my LAPP based system. I'm looking at options as
to how I can implement a system for printing the cards. As I see it, I have a
number of options.
1) mail-merge using Word.
Generate a CSV file via PHP for download.
Manual inte
t
}
[/code]
[output]
key [] value [xsd]
key [ ] value [xyz]
key [ ] value [ajk]
key [456] value [dfg]
key [123] value [abc]
[/output]
Example 2:
[code]
#Printing the hash in a single line
print "key $_ value $hash{$_}\n" foreach (keys %hash);
[/code]
[output]
key value xyz
array;
foreach $k (keys %hash){
print "key $k value $hash{$k}\n" if(exists $hash{$k});
}
And another issue is , I want to write one line code for printing hash like
below:
print "key $k value $hash{$k}\n" foreach $k (keys %hash);
But it fails with error :
syntax err
}\n";
}
[/code]
[output]
key abc:: value 123
key dfg:: value 456
key xsd:: value 34
[/output]
Hope it helps.
On Mon, Jun 23, 2014 at 1:31 AM, Sunita Pradhan <
sunita.pradhan.2...@hotmail.com> wrote:
> I have following code for printing a simple hash.
>
> #!/usr/bin/perl -w
>
On 06/22/2014 04:01 PM, Sunita Pradhan wrote:
I have following code for printing a simple hash.
#!/usr/bin/perl -w
%hash = ("abc" => 123, "dfg" => 456, "xsd" => 34);
foreach $k (keys %hash){
print "key $k:: value $hash{$k}\n";
On 22 Jun 2014, at 21:01, Sunita Pradhan
wrote:
> I have following code for printing a simple hash.
>
> #!/usr/bin/perl -w
> %hash = ("abc" => 123, "dfg" => 456, "xsd" => 34);
> foreach $k (keys %hash){
> print &qu
I have following code for printing a simple hash.
#!/usr/bin/perl -w
%hash = ("abc" => 123, "dfg" => 456, "xsd" => 34);
foreach $k (keys %hash){
print "key $k:: value $hash{$k}\n";
}
It does not print keys and displays following war
On Sun, Dec 1, 2013 at 7:28 AM, Shaji Kalidasan wrote:
> Dear Shlomi,
>
> I tried to install https://metacpan.org/release/XML-LibXML in my windows
> setup (using Strawberry Perl 5.18.1 on Windows 7) but it failed. Please
> suggest where am I going wrong?
>
> Here is the output from console (comman
k to God.
---
On Friday, 29 November 2013 1:53 PM, Shlomi Fish wrote:
Hello Shaji,
On Fri, 29 Nov 2013 13:32:49 +0800 (SGT)
Shaji Kalidasan wrote:
> Dear Perlers,
>
> I am trying to print double quotes in the o
i Kalidasan wrote:
> Dear Perlers,
>
> I am trying to print double quotes in the output (output.xml) but it is
> printing " instead of "". How can I include double quotes "" in the
> output. Please help.
>
In XML, «"» is an XML entity (see
https://en
Hello Shaji,
On Fri, 29 Nov 2013 13:32:49 +0800 (SGT)
Shaji Kalidasan wrote:
> Dear Perlers,
>
> I am trying to print double quotes in the output (output.xml) but it is
> printing " instead of "". How can I include double quotes "" in the
> output. Pleas
Dear Perlers,
I am trying to print double quotes in the output (output.xml) but it is
printing " instead of "". How can I include double quotes "" in the
output. Please help.
Here is the code
[code]
#!/usr/bin/perl
use strict;
use warnings;
use XML::DOM;
my $parse
i see, it changes 'destination' for the rest of the perl script, you mean.
i have another question which i will submit in new thread.
From: Shlomi Fish
To: Rajeev Prasad
Cc: perl list
Sent: Friday, June 28, 2013 11:45 AM
Subject: Re: printing
On Fri, 28 Jun 2013 07:37:57 -0700 (PDT)
Rajeev Prasad wrote:
> Shlomi/Uri,
> what do you mean by 'It's a good idea not to use "select" on filehandles like
> that because it willaffect the default filehandle permanently.'?
shlomif@lap:~$ cat Test.pl
#!/usr/bin/perl
use strict;
use warnings;
us
28, 2013 4:48 AM
Subject: Re: printing content of a pipe
Hi Rajeev,
see below for some comments on your code.
On Thu, 27 Jun 2013 15:07:50 -0700 (PDT)
Rajeev Prasad wrote:
> in the below code I am not able to print anything except whatever is in the
> $pty. I want to print LINE_START
On Jun 28, 2013 9:24 AM, "Shawn H Corey" wrote:
>
> On Fri, 28 Jun 2013 11:57:24 +0100
> Rob Dixon wrote:
>
> > On 28/06/2013 02:32, Uri Guttman wrote:
> > >
> > > you don't need
> > > ever to set $| on stderr as it is not buffered like stdout is. and
> > > you rarely need to set it on stdout as
On Fri, 28 Jun 2013 11:57:24 +0100
Rob Dixon wrote:
> On 28/06/2013 02:32, Uri Guttman wrote:
> >
> > you don't need
> > ever to set $| on stderr as it is not buffered like stdout is. and
> > you rarely need to set it on stdout as any print with a \n will
> > flush stdout.
>
> That isn't true.
>
On 28/06/2013 02:32, Uri Guttman wrote:
you don't need
ever to set $| on stderr as it is not buffered like stdout is. and you
rarely need to set it on stdout as any print with a \n will flush stdout.
That isn't true.
Perl will buffer STDOUT up to 8KB regardless of whether a newline has
been p
Shaji
---
Your talent is God's gift to you. What you do with it is your gift back to God.
---
From: Shlomi Fish
To: perl list
Sent: Friday, 28 June 2013 3:18 PM
Subject: Re: print
Hi Rajeev,
see below for some comments on your code.
On Thu, 27 Jun 2013 15:07:50 -0700 (PDT)
Rajeev Prasad wrote:
> in the below code I am not able to print anything except whatever is in the
> $pty. I want to print LINE_START: in the beginning of each line of the
> output, but it does not pr
On 06/27/2013 06:07 PM, Rajeev Prasad wrote:
in the below code I am not able to print anything except whatever is in the
$pty. I want to print LINE_START: in the beginning of each line of the output,
but it does not print that, it only prints what the output of the exceuted
command produced.
in the below code I am not able to print anything except whatever is in the
$pty. I want to print LINE_START: in the beginning of each line of the output,
but it does not print that, it only prints what the output of the exceuted
command produced. why is that so?
while(<$pty>) {
not printing
Hello,
Since I did not get any reply in last few hours. I am now posting this question
to the perl list too. I apologize if you mind. thank you.
starting with a hash ref
my $my_hash = {};
building the hash in a loop...
push(@tmp_arr,$val1);
push(@tmp_
Hello,
Since I did not get any reply in last few hours. I am now posting this question
to the perl list too. I apologize if you mind. thank you.
starting with a hash ref
my $my_hash = {};
building the hash in a loop...
push(@tmp_arr,$val1);
push(@tmp_arr,$val2);
timothy adigun wrote:
[snip]
my %new_hash = ();
foreach my $data1 ( keys %$hash1 ) {
while ( my ( $key, $value ) = each %$hash2 ) {
my ($new_value) = keys %$value;
$new_hash{$key} = $new_value if $data1 == $key;
}
}
No need for the nested llops:
my %new_hash;
for
Thank you very much.
That was the solution I was looking for.
Take care,
Chris
Hi Chris,
Please, check comments and codes below.
On Sun, Jul 8, 2012 at 6:19 AM, Chris Stinemetz wrote:
> Thank you very much for your responses.
>
> I have another question.
>
> I would like to replace the second element from hash1 with the second key
> from %hash2
>
> I believe what you
Thank you very much for your responses.
I have another question.
I would like to replace the second element from hash1 with the second key
from %hash2
Where both of the firsts keys match in the two hashes. I shortened the
sample data below but there will be a match for each instances of the key
On 07/07/2012 14:07, Chris Stinemetz wrote:
Hello list,
I have constructed an anonymous array with all the data I need.
I am having some difficulty in accessing and printing out the data the way
I want.
For the sake of not cluttering this thread too much I have uploaded the
anonymous array Data
gt;
>> On Sat, Jul 7, 2012 at 9:07 AM, Chris Stinemetz
>> wrote:
>> > Hello list,
>> >
>> > I have constructed an anonymous array with all the data I need.
>> > I am having some difficulty in accessing and printing out the data the
>> way
>&g
all the data I need.
> > I am having some difficulty in accessing and printing out the data the
> way
> > I want.
> > For the sake of not cluttering this thread too much I have uploaded the
> > anonymous array Data::Dumper output at github:gist
> >
> > https://
On Sat, Jul 7, 2012 at 9:07 AM, Chris Stinemetz
wrote:
> Hello list,
>
> I have constructed an anonymous array with all the data I need.
> I am having some difficulty in accessing and printing out the data the way
> I want.
> For the sake of not cluttering this thread too much I
Hello list,
I have constructed an anonymous array with all the data I need.
I am having some difficulty in accessing and printing out the data the way
I want.
For the sake of not cluttering this thread too much I have uploaded the
anonymous array Data::Dumper output at github:gist
https
> If there is anything I didn't explain well, just say so.
>
> Good job on your attempts.
>
> Steve
>
Thank you very much! I am very grateful for your help and explanations.
Take care,
Chris
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h.
On 2012-03-25 23:15, Chris Stinemetz wrote:
ok. You didn't do anything wrong per-se, all you did was try to go one
level too deep into your data structure.
$cell (eg 149) was the name of the key for the top-level %hash
container. All hash keys can only have one value associated with it. In
t
>
> replace all of this:
>
>
>> foreach my $hr ( sort keys %{ $href->{$cell}} ) {
>> # print "\t$hr";
>> foreach my $count ( sort keys %{ $href->{$cell}->{$hr}} ) { #<-- line
>> 48
>> print "\t$count";
>> }
>> }
>
>
> ...with this:
>
>
> foreach my $hr ( sort keys %{ $href->{
On 2012-03-25 22:39, Chris Stinemetz wrote:
Use a block sort to sort numerically:
perl -E '%h=qw(3 a 2 b 1 c 4 d); say sort { $a<=>$b } keys %h;'
Show us what you have so far if you need help with a specific code segment.
references are still a bit foreighn to me. Below is the error I am
ge
>
> Use a block sort to sort numerically:
>
> perl -E '%h=qw(3 a 2 b 1 c 4 d); say sort { $a<=>$b } keys %h;'
>
> Show us what you have so far if you need help with a specific code segment.
>
references are still a bit foreighn to me. Below is the error I am
getting along with the snippit of code.
On 2012-03-25 22:13, Chris Stinemetz wrote:
Any advice on how to include a numerical sort on the second key? I've
been trying to resolve this for a while and have had no luck.
Use a block sort to sort numerically:
perl -E '%h=qw(3 a 2 b 1 c 4 d); say sort { $a<=>$b } keys %h;'
Show us what y
On Mar 25, 2012 11:15 AM, "Steve Bertrand" wrote:
>
> On 2012-03-25 12:02, Chris Stinemetz wrote:
>>
>> How would I return the values along with the keys that meet the criteria
>> from the sub routine?
>
>
>> On Mar 25, 2012 10:04 AM, "Rob Dixon" wrote:
>
>
> Keeping with the use of $_, replace t
> code snippet:
> my $href = %data;
>
I changed my $href = %data; to my $href = \%data; and it works now.
Thanks all,
Chris
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
>
> Keeping with the use of $_, replace the following 'print map' statement to
> the following:
>
>
>>> print map "$_\n", @wanted;
>
>
> foreach ( @wanted ){
> print "$_:\n";
> foreach ( values %{ $href->{ $_ } } ){
> print "\t$_\n";
> }
> }
>
> ** OUTPUT **
>
> 149:
> 2
>
On 2012-03-25 12:02, Chris Stinemetz wrote:
How would I return the values along with the keys that meet the criteria
from the sub routine?
On Mar 25, 2012 10:04 AM, "Rob Dixon" wrote:
Keeping with the use of $_, replace the following 'print map' statement
to the following:
print map "$_
ave.
>>
>> What is the best approach for only printing the hashes that have the
>> value 'ND' or hashes that have different values such as '149' does
>> below.
>>
>> '149' => {
>>
On 25/03/2012 14:11, Chris Stinemetz wrote:
Below is snippet from Data::Dumper dump from a hash I have.
What is the best approach for only printing the hashes that have the
value 'ND' or hashes that have different values such as '149' does
bel
On 2012-03-25 15:11, Chris Stinemetz wrote:
What is the best approach for only printing the hashes that have the
value 'ND' or hashes that have different values such as '149' does
below.
Code it, in Perl.
--
Ruud
--
To unsubscribe, e-mail: beginners-unsubscr...@per
Below is snippet from Data::Dumper dump from a hash I have.
What is the best approach for only printing the hashes that have the
value 'ND' or hashes that have different values such as '149' does
below.
'149' => {
'05
bob wrote:
Hello
Hello,
I am very new to perl and I need some guidance on the following issue
My data set is like this
---
Record 38
Richard Nixon
http://en.wikipedia.org/wiki/Richard_Nixon
---
Record 39
Gerald Ford
http://en.wikipedia.org/wik
Hello
I am very new to perl and I need some guidance on the following issue
My data set is like this
---
Record 38
Richard Nixon
http://en.wikipedia.org/wiki/Richard_Nixon
---
Record 39
Gerald Ford
http://en.wikipedia.org/wiki/Gerald_Ford
-
On Sat, 03 Dec 2011 10:02:02 -0500, Zak Zebrowski wrote:
> Yes. Also, you may want to look at imager, which doesn't require image
> magic (which works better on some environments.). Also, the synopsis of
> imager produces thumbnails with perl.
>
> Best
> Zak
Ok, thanks. I'll with that..
--
Yes. Also, you may want to look at imager, which doesn't require image magic
(which works better on some environments.). Also, the synopsis of imager
produces thumbnails with perl.
Best
Zak
Sent from my iPod
On Dec 3, 2011, at 1:55 AM, Huub van Niekerk wrote:
> Hi,
>
> I want to use an ex
Hi,
I want to use an existing png image for changing into a smaller size and
write into a .pl file that will be printed. So far I've found several
posts talking about using ImageMagick and dealing with raster images, but
nothing tells me about writing in combination with .pl. Is this possible
SV> my @sorted_url_array = sort(@unique_url_array);
no need for the temp array:
my @sorted_url_array = sort keys %hash;
SV> print "Printing sorted_url_array:\n";
SV> for ($j=0; $j <= $#sorted_url_array; $j++)
no need for even the sorted temp array:
pace in the array
no need to preallocate arrays. and no need for $i. see below. just
declare that array as my @urls (no need to have 'array' as a suffix for
arrays).
SV> find (\&wanted, $dir_to_process);
SV> print "Printing url_array\n:";
SV> for ($j=0; $j <
ed_url_array = sort(@unique_url_array);
print "Printing sorted_url_array:\n";
for ($j=0; $j <= $#sorted_url_array; $j++)
{
print ($sorted_url_array[$j], "\n"); # This PRINTS sorted,
non-duplicate array
}
print "END Printing sorted_url_array\n";
sub wanted
r_to_process:$1";
print "Files in $dir_to_process are:\n";
$i = 0;
@url_array = (1..2000); # initialized to have enough space in the array
find (\&wanted, $dir_to_process);
print "Printing url_array\n:";
for ($j=0; $j <= $#url_array; $j++)
{
print ($url_array[$j
Hello Parag,
Vern Nice. Completely impressed. But I thought Perl might have some
internal variable at least for Kernel version. But anyways this work for
me too.
`Config` module's `config_re` function can be used:
=pod code
use Config 'config_re';
my ($os_version) = config_re('^osvers');
$o
perl -MConfig -e 'print "$Config{perlpath}:$^V\n$ENV{SHELL}:" . qx{ bash
> --version | head -1 } . "/kernel/$^O:" . qx{ uname -r }'
>
Vern Nice. Completely impressed. But I thought Perl might have some internal
variable at least for Kernel version. But anyways this work for me too.
~Parag
Hello Parag,
perl -MConfig -le 'print "$Config{perlpath}:$^V\n$ENV{SHELL}:
\n/kernel/$^O:"'
=pod code
perl -MConfig -e 'print "$Config{perlpath}:$^V\n$ENV{SHELL}:" . qx{ bash
--version | head -1 } . "/kernel/$^O:" . qx{ uname -r }'
=cut
Regards,
Alan Haggai Alavi.
--
The difference makes th
Hi,
Wanted to have suggestions to modify below 1 liner so that it can also print
Shell (preferably Bash) version and along with Operating System Kernel
version.
Currently I am just printing the place holders for Shell and Kernel version
numbers.
perl -MConfig -le 'print
"$Config{perlp
> "JG" == Jim Gibson writes:
JG> At 11:29 AM +0530 9/3/10, Jatin Davey wrote:
>> Any reason to use named variables than to use the default variable ($_) ?
JG> Two reasons that I know:
JG> 1. If you use a named variable, you and everybody else reading your
JG> code will know what i
> "JWK" == John W Krahn writes:
JWK> Uri Guttman wrote:
>>> "JD" == Jatin Davey writes:
>>
>> >> but it isn't as good as my code. don't use $_ unless you have to (as in
>> >> map/grep). it is much better to use named variables.
JD> Any reason to use named variables than to
Uri Guttman wrote:
"JD" == Jatin Davey writes:
>> but it isn't as good as my code. don't use $_ unless you have to (as in
>> map/grep). it is much better to use named variables.
JD> Any reason to use named variables than to use the default variable ($_)
?
yes, you can read the co
At 11:29 AM +0530 9/3/10, Jatin Davey wrote:
Any reason to use named variables than to use the default variable ($_) ?
Two reasons that I know:
1. If you use a named variable, you and everybody else reading your
code will know what it is for. While it doesn't matter much for
3-line loops, s
yes, you can read the code and see what the variable is for. $_ is
useful in some situations but not for foreach loops and similar
things. names are important in code and $_ has no name. you lose the
opportunity to tell the reader of the code what the variable contains
and what it is used for.
> "JD" == Jatin Davey writes:
>> but it isn't as good as my code. don't use $_ unless you have to (as in
>> map/grep). it is much better to use named variables.
JD> Any reason to use named variables than to use the default variable ($_) ?
yes, you can read the code and see what the var
but it isn't as good as my code. don't use $_ unless you have to (as in
map/grep). it is much better to use named variables.
Any reason to use named variables than to use the default variable ($_) ?
and please learn to edit quoted emails and to bottom post. you can google for
what that means.
> "JD" == Jatin Davey writes:
JD> for (keys %months) {
JD> print "Months in $_ : @{$months{$_}} \n";
JD> }
JD> and it worked fine.
but it isn't as good as my code. don't use $_ unless you have to (as in
map/grep). it is much better to use named variables.
JD> On 9/3/2010 10:47
Changed it to:
#!/usr/bin/perl
use warnings;
use strict;
my @english = qw(january february march april may june july);
my @french = qw(janvier fverier mars avril mai juin juily);
my %months;
$months{english} = \...@english;
$months{french} = \...@french;
for (keys %months) {
print "Months in
> "JD" == Jatin Davey writes:
JD> #!/usr/bin/perl
JD> use warnings;
JD> use strict;
very good to see those.
JD> my @english = qw(january february march april may june july);
JD> my @french = qw(janvier fverier mars avril mai juin juily);
JD> my %months;
JD> my $eng_ref;
JD>
Hi
I am a newbie to Perl , I have this piece of code :
*CODE:*
#!/usr/bin/perl
use warnings;
use strict;
my @english = qw(january february march april may june july);
my @french = qw(janvier fverier mars avril mai juin juily);
my %months;
my $eng_ref;
my $fre_ref;
$eng_ref = \...@english;
$
Erik Witkop wrote:
There is one more task that I am unable to solve.
If $_ was something like FYUY or fO76, I would like to remove the
first ^[Ff].But keep the last 3 character.
Find and Replace does not work obviously as I would lose those last 3
characters that I want. I researched the map f
If you don't mind a newbie trying to help...
Since you want to replace something, using bare //'s won't do, since that's
an alias for m//; m, as in match. You want a substitution, s///.
The regex you are looking for should look something like this (Untested
code):
> s/
> \b #Word boundary
On Jul 27, 11:34 pm, u...@stemsystems.com ("Uri Guttman") wrote:
> > "EW" == Erik Witkop writes:
>
> EW> I have spent half the day looking at map and I still don't get it.
>
> it is easier than you think.
>
> EW> I don't get the EXPR versus BLOCK and how I can treat them differently.
>
> t
> "EW" == Erik Witkop writes:
EW> I have spent half the day looking at map and I still don't get it.
it is easier than you think.
EW> I don't get the EXPR versus BLOCK and how I can treat them differently.
that is mostly a syntax difference. you can have a single expression,
then a com
Hi Uri,
I have spent half the day looking at map and I still don't get it.
I don't get the EXPR versus BLOCK and how I can treat them differently.
I think I am close but my regex is not hitting.
/@final_results = map { m/^[a-zA-Z0-9]{3,4}?$/$1/ } @just_cust_codes;
foreach (@final_results){
pr
Thanks Uri.
It is time that I learned map. I typically lean on grep and =~ for
matching patterns. But map sounds like a great solution.
Thanks again.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
> "EW" == Erik Witkop writes:
EW> Thanks Uri.
EW> It is time that I learned map. I typically lean on grep and =~ for
EW> matching patterns. But map sounds like a great solution.
grep is NOT a regex function or has anything to do with regexes. get
that false association out of your head
> "EW" == Erik Witkop writes:
EW> So I have an array full of elements in the following format:
EW> 32F--sometext--x
EW> F32-sometext12-xxx
EW> I am only interested in the first portion before the first hyphen.
EW> I am able to grep to get that portion.
grep doesn't give back
Erik Witkop wrote:
So I have an array full of elements in the following format:
32F--sometext--x
F32-sometext12-xxx
I am only interested in the first portion before the first hyphen.
I am able to grep to get that portion.
@grep_results1 = grep(/[a-zA-Z0-9]{2,4}-/, @sho_port_small_array);
1 - 100 of 839 matches
Mail list logo