Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

strawberry on XP

by ray.perlling (Initiate)
on May 22, 2008 at 10:31 UTC ( [id://687923]=perlquestion: print w/replies, xml ) Need Help??

ray.perlling has asked for the wisdom of the Perl Monks concerning the following question:

this program doesn't run I don't know why Iam using strawberry in a Xp machine
#! perl use Benchmark; @junk = cat /etc/motd; $count=10_000; timethese($count, { 'map' =>sub {my @a=@junk; map {s/a/b } @a; return @a }, 'for' =>sub {my @a=@junk; for (@a) { s/a/b/}; return @a}, }); "my $var = defined(<STDIN>)";

Replies are listed 'Best First'.
Re: strawberry on XP
by mwah (Hermit) on May 22, 2008 at 10:42 UTC

    Your program:

    use strict; use warnings; use Benchmark; my @junk = `cat /etc/motd`; # not available on windows my $count = 10_000; timethese($count, { 'map' => sub { my @a = @junk; map { s/a/b/ } @a; return @a }, 'for' => sub { my @a = @junk; for (@a) { s/a/b/ }; return @a }, } ); # "my $var = defined(<STDIN>)";

    wouldn't work because there's no cat and no /etc/motd available on your box (probably)

    Other reasons: there were loads of typos (corrected).

    Regards

    mwa

Re: strawberry on XP
by marto (Cardinal) on May 22, 2008 at 10:49 UTC
    Did you copy this code from some website? As far as I am aware Windows XP does not have a cat command (perhaps type is what you are looking for), or as standard a file /etc/motd. Please read How do I post a question effectively? and the PerlMonks FAQ if you have not already done so.

    Martin

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-19 18:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found