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

Re^4: Completing a list/ array?

by Taylorswift13 (Novice)
on Nov 12, 2011 at 17:41 UTC ( #937764=note: print w/ replies, xml ) Need Help??

in reply to Re^3: Completing a list/ array?
in thread Completing a list/ array?

Hi yes i think your assumption is correct

I attempted your program but get an error message

 Can't locate Modern/ in @INC (@INC contains: /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.3 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at ./aari.txt line 2.

i installed the latest version from the website am i meant to install something different?

This is perl 5, version 12, subversion 3 (v5.12.3) built for darwin-t +hread-multi-2level (with 2 registered patches, see perl -V for more detail) Copyright 1987-2010, Larry Wall

once again sorry about my dumbnes

EDIT aha i have installed modern perl

Comment on Re^4: Completing a list/ array?
Select or Download Code
Replies are listed 'Best First'.
Re^5: Completing a list/ array?
by Not_a_Number (Parson) on Nov 12, 2011 at 18:38 UTC

    OK, now that's fixed, try this:

    use Modern::Perl; use autodie; my $infile = '/Users/ts/desktop/work/numbers.txt'; # Hmm... my $outfile = 'Users/ts/full_number.txt'; # leading '/' or n +ot? open my $in, '<', $infile; my @result; while ( <$in> ) { my ( $index, $value ) = split; $result[$index] = $value; } close $in; open my $out, '>', $outfile; say $out "$_\t", $result[$_] || 0 for 1 .. 3_000_050; close $out;

      Hi i tried doing this but i can't seem to open the output file to write in it i checked and it is definatly the right path the same happened with the previous attempt where the results just came up on terminal and not the outputfile i tried ending with a / but no difference

      Can't open 'Users/ts/full_number.txt/' for writing: 'No such file or directory' at ./program13.txt line 18

      EDIT OH i understand now leading /!! yes that fixed it thank you very much

Re^5: Completing a list/ array?
by aaron_baugher (Curate) on Nov 12, 2011 at 18:36 UTC

    Sorry, I should have used the built-in stuff. Modern::Perl basically saves a few lines of typing by activating some things that are good practices for every program.

    Aaron B.
    My Woefully Neglected Blog, where I occasionally mention Perl.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://937764]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2015-11-27 12:16 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (727 votes), past polls