Walls might not keep everyone out, but throw in some traditional measures (border patrols, deportations and whatnot) and the number of illegal crossings tend to drop by quite a bit. A relatively recent example that comes to mind would be countries like Hungary and Israel.