Nieuws:

Ubuntu-NL weer online!

Na een periode van technische problemen en een overbelaste server zijn we eindelijk weer bereikbaar.
Samen met Hobbynet, onze sponsor en hostingpartner, hebben we een oplossing gevonden zodat alles weer soepel draait.

Bedankt voor jullie geduld en begrip. We hopen nu weer verder te gaan waar we gebleven waren.

Het team van Ubuntu-NL

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: help met perl tut.  (gelezen 1848 keer)

Offline xellos

  • Lid
help met perl tut.
« Gepost op: 2009/04/18, 18:41:14 »
ik ben bezig met een perl tut maar weet niet hoe ik dit voor mekaar kan krijgen .
http://www.comp.leeds.ac.uk/Perl/filehandling.html#exercise
dat is de link naar de tut.
nou bij de oefening moet je dit doen

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.

en hier is dat programma.
#!/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



ik heb echt geen idee hoe dit moet kan iemand mij helpen?

Offline xellos

  • Lid
Re: help met perl tut.
« Reactie #1 Gepost op: 2009/04/19, 16:27:29 »
kan iemand mij mischien helpen?

alvast bedankt...

Offline profoX

  • Lid
    • wesley
    • Lionslink
Re: help met perl tut.
« Reactie #2 Gepost op: 2009/04/19, 17:15:31 »
probeer dit:

$" = "#";
print "#@lines";

niet erg logisch vind ik persoonlijk, maar het is dan ook perl.. :P
Human Knowledge Belongs To The World -- Antitrust (2001)
Nederlandstalige Ubuntu documentatie van Ubuntu-NL (wiki)