Shlomi Fish avatar Shlomi Fish committed b6c1080

Add more.

Comments (0)

Files changed (2)

 
 * Add a link to perlweekly.com somewhere.
 
+* Add a page about file/directory-handling :
+    - TODO: Add cookbook:
+        - appending to files.

src/topics/files-and-directories/index.html.wml

 
 </div>
 
+<set-var idbase="append_to_file" />
+<set-var io_all_id="<get-var idbase />__io_all" />
+<set-var core_id="<get-var idbase />__core" />
+
+<h3 id="<get-var idbase />">Appending to a File</h3>
+
+<div class="tabs">
+
+<ul>
+
+<li><a href="#<get-var io_all_id />">IO-All</a></li>
+
+<li><a href="#<get-var core_id />">Core Perl</a></li>
+
+</ul>
+
+<div id="<get-var io_all_id />">
+
+<perl_code>
+use IO::All;
+
+my $string_to_append = "My new line\n";
+
+$string_to_append >> io->file($my_file_path);
+</perl_code>
+
+</div>
+
+<div id="<get-var core_id />">
+
+<perl_code>
+use autodie;
+
+my $string_to_append = "My new line\n";
+
+{
+    open my $out, '>>', $my_file_path;
+    print {$out} $string_to_append;
+    close($out);
+}
+</perl_code>
+
+</div>
+
+</div>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.