Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Gentleman, I'm lost.

by GrandFather (Sage)
on Nov 26, 2016 at 05:17 UTC ( #1176580=note: print w/replies, xml ) Need Help??


in reply to Gentleman, I'm lost.

We are flattered that you think we can intuit your code and provide guidance without seeing it. The truth however is that we have no idea what you have tried nor where you are having trouble or even what you are using as a guide to get you started.

So, in the first instance head on over to Tutorials and see how you get on there. I'd recommend that you don't try to solve the whole thing in one go. Instead work at it a tiny bit at a time. Have you even gotten a script to print "Hello world." when you run it? If not, that's your first task. Come back and ask if you have trouble doing that, or tell us it was a piece of cake and you are figuring out the next small piece.

Premature optimization is the root of all job security

Replies are listed 'Best First'.
Re^2: Gentleman, I'm lost.
by Ryanjohns on Nov 26, 2016 at 05:42 UTC
    #!/usr/bin/perl use 5.010; use strict; use warnings; use Path::Tiny qw(path); use List::Util qw(sum); use List::MoreUtils qw(first_index); use Scalar::Util qw(looks_like_number); use Lingua::EN::Numbers qw(num2en num2en_ordinal); my $filename = 'C:\Users\Ryan\Desktop\practice.txt'; my @content = path($filename)->lines_utf8; my $filehandle = 'C:\Users\Ryan\Desktop\practice_new.txt'; open(my $fh, '>', $filehandle); my $count = 0; foreach my $row(@content){ my $rowsaver = $row; my @phrases = split(/[,.;:]/, $row); foreach my $phrase (@phrases){ my $saver = $phrase; $phrase=~ tr/0123456789/0000000000/; $phrase=~ tr/abcdefghijklmnopqrstuvwxyz/12345678912345678912345678/; $phrase=~ tr/ABCDEFGHIJKLMNOPQRSTUVWXYZ/12345678912345678912345678/; my @words = split (/ /,$phrase); my @fchk = split (//,$words[0]); my $rowvalue = first_index {$_ = $row} @content; my @lnums = split (//,$phrase); my $value = sum @lnums; first_index{my $fws eq $rowsaver }@content; my $pchk = sum(@fchk); print $fh "$fws"; } }

    Update: no really tho. yalll are useless.

      What does this code have to do with the problem you stated above? What does this code do and where does it not do what you need? It seems to convert all text into digits, but there seems to be no attempt to prepend some text to the output.

        right, do you know how to do that?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1176580]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2018-07-18 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (383 votes). Check out past polls.

    Notices?