#!/usr/bin/perl -w use strict; use Inline C =><<'END_OF_C_CODE'; #include void get_date( char* str ) { /* much thanks to wog and talexb for suggestions */ char date[9]; /* the date to return */ int index = 0; /* index of character in string */ Inline_Stack_Vars; Inline_Stack_Reset; while ( str[index++] != '|' ); strncpy( date, &str[index], 8); Inline_Stack_Push(newSVpvf(date)); Inline_Stack_Done; } END_OF_C_CODE print get_date("adb|20011225|asdf");