Hi Everyone

As you can see from the description of this list
http://learn.perl.org/faq/beginners.html Thomas J Hughes' response is
inappropriate and I've raised this issue with the moderator.

Please carry on with the polite and helpful discussions for which this
list has a reputation to uphold.

Andrew


On Mon, Feb 1, 2016 at 2:33 PM, Danny Spell <ddsp...@gmail.com> wrote:
> Isn't this a beginners' list?
>
> Regards,
> Danny Spell
> DDSpell Consulting
> 214-682-4898
>
> On Mon, Feb 1, 2016 at 7:34 AM, Thomas J Hughes <thugh...@gmail.com> wrote:
>>
>> Go read a fuckin book and stop spamming people's email or I will hack
>> yours !!!!! If you want to learn a language you need to first learn the
>> basis stupid and build from their people are not going to tell you have
>> shotcut something learn to read asshole
>>
>>
>>
>>
>>
>> WARNING TO ALL VETERANS:
>>
>> https://www.oathkeepers.org/us-senate-passes-bill-approving-mandatory-vaccinations-for-veterans/
>>
>>
>>
>>
>> On Fri, Jan 29, 2016 at 9:24 PM, Frank Vino <vinofra...@gmail.com> wrote:
>>>
>>> Thanks a lot Jonathan, i will set the env properly then i will try.
>>>
>>>
>>> -Frank
>>>
>>> On Fri, Jan 29, 2016 at 3:36 PM, Jonathan Harris
>>> <jtnhar...@googlemail.com> wrote:
>>>>
>>>> Hi Frank,
>>>> Please would you remember to Reply All to the list as well?
>>>>
>>>> It just seems that the path is not included in @INC
>>>> You can check on the command line:
>>>>
>>>> perl -e "print qq(@INC)"
>>>>
>>>> I can't tell how you installed Perl and cpan but that's the result!
>>>>
>>>> Anyways, it's easily fixed.
>>>>
>>>> At the start of the script, use:
>>>>
>>>> use lib 'C:\Perl64\cpan\build';
>>>> use File::Slurp qw( :edit );
>>>>
>>>> However, this would have to be added to every script.
>>>> If the path is an issue for all scripts, then it would be better to make
>>>> the change permanent.
>>>> There are good instructions here to adding the Environment Variable:
>>>>
>>>>
>>>> http://perlmaven.com/how-to-change-inc-to-find-perl-modules-in-non-standard-locations
>>>>
>>>> Good luck!
>>>> Jon
>>>>
>>>>
>>>> On Fri, Jan 29, 2016 at 4:08 AM, Frank Vino <vinofra...@gmail.com>
>>>> wrote:
>>>>>
>>>>> Hi Jonathan,
>>>>>
>>>>> I am using Windows OS i tried but i got some error message i am
>>>>> attaching the message here
>>>>>
>>>>> Output:
>>>>>
>>>>> C:\Users\Franklin_Lawerence\Desktop\perl>arrarsize.pl
>>>>> Can't locate File/Slurp.pm in @INC (@INC contains: C:/Perl64/site/lib
>>>>> C:/Perl64/lib .) at C:\Users\Franklin_Lawerence\Desktop\perl\arrarsize.pl
>>>>> line 5.
>>>>> BEGIN failed--compilation aborted at
>>>>> C:\Users\Franklin_Lawerence\Desktop\perl\arrarsize.pl line 5.
>>>>>
>>>>> C:\Users\Franklin_Lawerence\Desktop\perl>
>>>>>
>>>>>
>>>>> File-Slurp installed in below Program files folder:
>>>>>
>>>>> C:\Perl64\cpan\build\File-Slurp-9999.19-_tH9hN
>>>>>
>>>>> On Thu, Jan 28, 2016 at 11:27 PM, Jonathan Harris via beginners
>>>>> <beginners@perl.org> wrote:
>>>>>>
>>>>>> Hi,
>>>>>> I found that this works, assuming that the module is installed.
>>>>>>
>>>>>> #!/usr/bin/perl
>>>>>> use warnings;
>>>>>> use strict;
>>>>>> use File::Slurp qw ( :edit );
>>>>>> #
>>>>>> my $file_to_edit = 'path-to-file.txt';
>>>>>> #
>>>>>> my $word_to_edit = "Debug";
>>>>>> my $new_word = "Error";
>>>>>> #
>>>>>> edit_file { s/$word_to_edit/$new_word/g } ( $file_to_edit );
>>>>>> #
>>>>>>
>>>>>> This will work if you have the word Debug, Debug_ etc etc
>>>>>> You can just use s/Debug/Error/g but I like the variables as it allows
>>>>>> flexibility if the script was to expand to further uses
>>>>>>
>>>>>> Hope that helps,
>>>>>> Jon
>>>>>>
>>>>>>
>>>>>> On Thu, Jan 28, 2016 at 3:41 PM, Jim Gibson <j...@gibson.org> wrote:
>>>>>>>
>>>>>>>
>>>>>>> > On Jan 28, 2016, at 1:37 AM, Frank Larry
>>>>>>> > <frankylarry2...@gmail.com> wrote:
>>>>>>> >
>>>>>>> > Hi Team,
>>>>>>> >
>>>>>>> >  could you please let me? i have a file which contains "Debug", i
>>>>>>> > would like to replace debug to "Error", when i ran the below program 
>>>>>>> > the out
>>>>>>> > showing Error message but how to save the output with new changes. 
>>>>>>> > Could you
>>>>>>> > please tell me how to fix it?
>>>>>>>
>>>>>>> The way to do this within a larger Perl program is to open a new
>>>>>>> output file, copy all of the possibly-modified lines to this file. Then 
>>>>>>> you
>>>>>>> can rename the new file to the same name as the old file, and perhaps 
>>>>>>> rename
>>>>>>> the old file as well and keep it around as a backup.
>>>>>>>
>>>>>>> >
>>>>>>> > open(FILE, "<filter.txt") or die "Can’t open $!\n”;
>>>>>>>
>>>>>>> The three-argument version of open is preferred here, and let’s put
>>>>>>> the file name in a variable and use a lexical variable for the file 
>>>>>>> handle
>>>>>>> (untested):
>>>>>>>
>>>>>>> my $filename = ‘filter.txt’;
>>>>>>> open( my $in, ‘<‘, $filename ) or die(“Can’t open $filename for
>>>>>>> reading: $!”);
>>>>>>>
>>>>>>> # create a new file
>>>>>>> my $newfile = $filename . ‘.new’;
>>>>>>> open( my $out, ‘>’, $newfile ) or die(“Can’t create $newfile: $!”);
>>>>>>>
>>>>>>> >
>>>>>>> > while($line = <FILE>){
>>>>>>>
>>>>>>> while( $line = <$in> ) {
>>>>>>>
>>>>>>> >
>>>>>>> >    print "Before substituting: ", $line ,"\n";
>>>>>>> >     $line =~ s/Debug/Error/g;
>>>>>>> >     print "After substituting : ", $line , "\n”;
>>>>>>>
>>>>>>>         print $out $line;
>>>>>>> >
>>>>>>> > }
>>>>>>> >
>>>>>>> > close(FILE);
>>>>>>>
>>>>>>> close($in);
>>>>>>> close($out) or die(“Error writing to output file $newfile: $!”);
>>>>>>>
>>>>>>> # rename the old file
>>>>>>> my $savefile = $filename . ‘.sav’;
>>>>>>> rename $filename, $savefile;
>>>>>>>
>>>>>>> # rename the new file
>>>>>>> rename $newfile, $filename;
>>>>>>>
>>>>>>> Jim Gibson
>>>>>>> j...@gibson.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
>>>>>>> For additional commands, e-mail: beginners-h...@perl.org
>>>>>>> http://learn.perl.org/
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>



-- 
Andrew Solomon

Mentor@Geekuni http://geekuni.com/
http://www.linkedin.com/in/asolomon

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to