<?xml version="1.0" encoding="windows-1252"?>
<node id="422742" title="Answer: How do I extract a file name from a path string" created="2005-01-17 09:50:07" updated="2005-08-11 22:07:04">
<type id="1888">
categorized answer</type>
<author id="11732">
QandAEditors</author>
<data>
<field name="doctext">
This works for both DOS and UNIX path separators and when there is no path info.
&lt;code&gt;
( $dir, $file ) = m/(.*)[\\\/](.+)/ ? ( $1, $2 ) : ( undef, $_ ); 
&lt;/code&gt;</field>
<field name="parent_node">
35235</field>
</data>
</node>
