in reply to check in an array for variable
also having trouble understanding what you were aiming for....
but here is what i figured you were looking for...
cheers#!/usr/bin/perl while(<DATA>){ chomp($_); my @array = split("&|”|“|'",$_); foreach (@array){ ($_ eq ' ') ? (print "--Value missing--") : (print $_) } } __DATA__ ” How big are & the Brothers? ” “ One day hiere last wee +k, not knowing the cause, some floors of Rockefeller Center were evacuated when the floor shaking and screams of the lads' fans during a TV
Update:
is this ok :)while(<DATA>){ chomp($_); my @array1 = split(/(&|”|“|')/,$_); foreach (@array1){ ($_ eq ' ') ? (print "--Value missing--\n") : (print $_ . "\n") } } result ” How big are & the Brothers? ” --Value missing-- “ One day hiere last week, not knowing the cause, some floors of Rockefeller Center were evacuated when the floor shaking and screams of the lads ' fans during a TV
if the spitted sentence (One day hiere...) is annoying you it is up to you to fix it :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: check in an array for variable
by Anonymous Monk on Aug 13, 2009 at 09:11 UTC | |
by moritz (Cardinal) on Aug 13, 2009 at 10:52 UTC |