Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Using $"

by Bugz (Acolyte)
on Dec 22, 2014 at 20:21 UTC ( [id://1111074]=note: print w/replies, xml ) Need Help??


in reply to Re: Using $"
in thread Using $"

http://www.comp.leeds.ac.uk/Perl/filehandling.html
#!/usr/local/bin/perl # # Program to open the password file, read it in, # print it, and close it again. $file = '/etc/passwd'; # Name the file open(INFO, $file); # Open the file @lines = <INFO>; # Read it into an array close(INFO); # Close the file print @lines; # Print the array

Exercise
Modify the above program so that the entire file is printed with a # symbol at the beginning of each line. You should only have to add one line and modify another. Use the $" variable.

Replies are listed 'Best First'.
Re^3: Using $"
by 2teez (Vicar) on Dec 22, 2014 at 20:31 UTC

    http://www.comp.leeds.ac.uk/Perl/
    Is Perl4 Archives! Perl5 is in 5.21 and Perl6 is almost here!
    I will advice, you use the alternative link, the webpage link to after some seconds.

    If you tell me, I'll forget.
    If you show me, I'll remember.
    if you involve me, I'll understand.
    --- Author unknown to me
Re^3: Using $"
by LanX (Saint) on Dec 22, 2014 at 21:41 UTC
    Did you read the intros? :)

    Legacy Tutorials

    These are old Perl tutorials that are well written and good references for old versions, but should not be used by newcomers to learn Perl.

    ... and. ..

    Please note: This tutorial was written in the early 1990's for version 4 of Perl. Although it is now significantly out of date, it was a popular source of information for many people over many years. It has therefore been left on-line as part of the historical archive of the Internet.

    Cheers Rolf

    (addicted to the Perl Programming Language and ☆☆☆☆ :)

Re^3: Using $"
by soonix (Canon) on Dec 25, 2014 at 07:57 UTC
    besides from being outdated (the others already said it), the task would have been to just print the modified data, not to rewrite the original file...

Log In?
Username:
Password:

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

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

    No recent polls found